I'm using Google Maps in a Flutter app. I'm looking for a way to style the map on a black and white edition. I've seen this done in web editions, but not sure if it's possible in the Flutter edition...yet. Wonder if anyone else has achieved this and how?
Asked
Active
Viewed 2,849 times
-1
-
1Possible duplicate of https://stackoverflow.com/questions/49953913/flutter-styled-map – MrUpsidown Dec 11 '19 at 09:48
-
Also I was able to find examples and documentation in like 10 seconds by searching the web... – MrUpsidown Dec 11 '19 at 09:49
-
Well then you found something that helped me and I missed – Rasmus Christensen Dec 11 '19 at 10:35
-
The answer you accepted is basically a copy+paste of [this article](https://medium.com/@matthiasschuyten/google-maps-styling-in-flutter-5c4101806e83) without the details... – MrUpsidown Dec 11 '19 at 10:39
1 Answers
7
First you have to get a style.json from: https://mapstyle.withgoogle.com/ and add it to your assets.
assets:
- assets/json_assets/
Then you add this to your init State where the google Maps widget is
@override
void initState() {
super.initState();
rootBundle.loadString('assets/json_assets/map_style.txt').then((string) {
_mapStyle = string;
});
}
and last but not least your Map Created function should look like this:
void _onMapCreated(GoogleMapController controller) {
controller.setMapStyle(_mapStyle);
_mapController = controller;
initMemoryClustering();
}

Markus Hein
- 604
- 7
- 14
-
Thanks, I found the styling, but missed the setMapStyle. Thank you :) – Rasmus Christensen Dec 11 '19 at 10:36