Skip to content

Commit 65b6183

Browse files
committed
[google_maps_flutter_web] Prevent style conflict with cloudMapId
Fixes #161951 When a 'cloudMapId' is used, the Google Maps JS API does not allow the `styles` property to be set on the map options. This change modifies the `_configurationAndStyleToGmapsOptions` method to ensure that the `styles` property is only applied when `configuration.mapId` is null. This resolves the console warning and allows cloud-based styling to work as intended.
1 parent 08a9b2c commit 65b6183

File tree

1 file changed

+5
-3
lines changed
  • packages/google_maps_flutter/google_maps_flutter_web/lib/src

1 file changed

+5
-3
lines changed

packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,17 @@ gmaps.MapOptions _configurationAndStyleToGmapsOptions(
9595
options.rotateControl = configuration.fortyFiveDegreeImageryEnabled;
9696
}
9797

98+
// If using cloud map, do not set options.styles
99+
if (configuration.cloudMapId == null) {
100+
options.styles = styles;
101+
}
102+
98103
// These don't have any configuration entries, but they seem to be off in the
99104
// native maps.
100105
options.mapTypeControl = false;
101106
options.fullscreenControl = false;
102107
options.streetViewControl = false;
103108

104-
// See updateMapConfiguration for why this is not using configuration.style.
105-
options.styles = styles;
106-
107109
options.mapId = configuration.cloudMapId;
108110

109111
return options;

0 commit comments

Comments
 (0)