Open cedvdb opened 1 month ago
Thanks for the report @cedvdb Have you checked this information from package's readMe ? https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter#cloud-based-map-styling
@darshankawar the part of the readme you linked does not seem to be relevant to this issue.
I believe the issue is that the plugin, in the source code, still provides style information to google map, last time I checked the source code. It should not pass style information if a cloud id was provided
It's been a long time I checked the source code of flutter_google_map
but last time this involved some sort of map that was edited with all values passed to google map. The style / styling key should not be added when there is a cloudMapId
provided by the user of the plugin
Thanks for the update. It looks like it is something coming from Google's maps directly based on https://issuetracker.google.com/issues/161501609?pli=1 that you can check
Edit: Nvm, I made a fix https://github.com/flutter/packages/pull/6821
@darshankawar No. I know you have a lot of issues to track so I'll be more clear.
You cannot use mapIds (cloud map id) and styles at the same time. When you do, you'll get the warning.
Google Maps JavaScript API: A Map's styles property cannot be set when a mapId is present. When a mapId is present, Map styles are controlled via the cloud console. Please see documentation at ...
Internally the flutter packages passes both to gmap. It should not give the styles in configuration at all (even if empty) when it receives a cloud map id because cloud map id are already used for styling.
From a quick look the issue might be on this line which should not add anything if a cloudMapId is set (i'm not sure though).
Changing it into something like the following might solve the issue.
if (! cloudMapId) {
options.styles = styles;
}
Thanks for the feedback and potential fix. I was able to see the warning while trying to run the plugin example on web platform.
@ditman It sounds like we are unconditionally using map style internally in the web implementation somewhere?
@stuartmorgan I believe there https://github.com/flutter/packages/pull/6821/files#diff-ad093591ababe86bff6ff2af9ce718a9b0ef32f011611922b7d245420c71cb27L87 , at least that seems to solve the issue.
Steps to reproduce
Warning:
Expected results
no warning
Actual results
Code sample
Code sample
```dart GoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, onTap: (LatLng pos) { setState(() { _lastTap = pos; }); }, onLongPress: (LatLng pos) { setState(() { _lastLongPress = pos; }); }, cloudMapId: 'YOUR ID HERE', ) ```Screenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console [Paste your logs here] ```Flutter Doctor output
example (main): flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.22631.3593], locale en-BE) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.32) [√] Android Studio (version 2023.1) [√] VS Code (version 1.89.1) [√] Connected device (3 available) [√] Network resources
• No issues found!