Home:ALL Converter>Flutter Google maps - how to use Cloud Styling

Flutter Google maps - how to use Cloud Styling

Ask Time:2021-01-07T22:03:56         Author:Goowik

Json Formatter

I was just reading about the possibilities to style the Google maps through the Cloud. This makes it easier to style them without actually needing to redeploy the application.

Here are the 2 documentations I found for Android and IOS:

For Android it seems like a simple solution, just add the fragment to the xml file and that's it. Unfortunately for IOS, you need to initialise it when creating the Google Maps.

example Android

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string name="map_id">YOUR_MAP_ID</string>
</resources>

example IOS

let camera = GMSCameraPosition(latitude: 47.0169, longitude: -122.336471, zoom: 12)
let mapID = GMSMapID(identifier: "<YOUR MAP ID>")
let mapView = GMSMapView(frame: .zero, mapID: mapID, camera: camera)
self.view = mapView

This in combination with the flutter plugins, seems like a lot of overhead. Is there maybe a simpler way to add the MapId? For now I'm using the https://pub.dev/packages/google_maps_flutter plugin

Author:Goowik,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65613810/flutter-google-maps-how-to-use-cloud-styling
yy