Skip to content

Conversation

WillBLogical
Copy link

@WillBLogical WillBLogical commented Aug 22, 2025

When cloudMapId is set, styles must be omitted to avoid conflicts. Now we set MapOptions.mapId and leave styles null in that case.

Tests: add cloud_map_styles_test (web integration) to verify:

  • cloudMapId present ⇒ styles omitted, mapId set
  • no cloudMapId ⇒ styles applied

Fixes flutter/flutter#161951

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

When `cloudMapId` is set, styles must be omitted to avoid conflicts.
Now we set `MapOptions.mapId` and leave `styles` null in that case.

Tests: add `cloud_map_styles_test` (web integration) to verify:
- cloudMapId present ⇒ styles omitted, mapId set
- no cloudMapId ⇒ styles applied
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue where using cloudMapId for cloud-based styling on the web would fail if the style property was also present. The change correctly omits setting styles on the map when a cloudMapId is provided. New integration tests are added to verify that styles are omitted when cloudMapId is present, and applied when it's not. The implementation is correct, but my feedback points out the use of a deprecated cloudMapId property, suggesting to use the current mapId property instead. This is to adhere to the project's style guide, which recommends following Effective Dart style, including avoiding deprecated members.

WillBLogical and others added 8 commits August 22, 2025 05:17
Linux analyze_downgraded stableFailing after 6m — Linux analyze_downgraded stable
  error - lib/src/convert.dart:103:21 - The getter 'mapId' isn't defined for the type 'MapConfiguration'. Try importing the library that defines 'mapId', correcting the name to the name of an existing getter, or defining a getter or field named 'mapId'. - undefined_getter

1 issue found.
When `cloudMapId` is set, styles must be omitted to avoid conflicts.
Now we set `MapOptions.mapId` and leave `styles` null in that case.

Tests: add `cloud_map_styles_test` (web integration) to verify:
- cloudMapId present ⇒ styles omitted, mapId set
- no cloudMapId ⇒ styles applied
Linux analyze_downgraded stableFailing after 6m — Linux analyze_downgraded stable
  error - lib/src/convert.dart:103:21 - The getter 'mapId' isn't defined for the type 'MapConfiguration'. Try importing the library that defines 'mapId', correcting the name to the name of an existing getter, or defining a getter or field named 'mapId'. - undefined_getter

1 issue found.
@WillBLogical WillBLogical force-pushed the fix-maps-web-style-conflict-v2 branch from e65b28e to 08c8c84 Compare August 22, 2025 21:07
@stuartmorgan-g stuartmorgan-g added the triage-web Should be looked at in web triage label Aug 26, 2025
@mdebbar mdebbar requested review from mdebbar and removed request for ditman August 27, 2025 18:07
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@mdebbar mdebbar requested a review from stuartmorgan-g August 27, 2025 22:19
@WillBLogical WillBLogical force-pushed the fix-maps-web-style-conflict-v2 branch from c98003a to b9b4b66 Compare August 29, 2025 17:40
@@ -115,15 +115,17 @@ gmaps.MapOptions _configurationAndStyleToGmapsOptions(
options.rotateControl = configuration.fortyFiveDegreeImageryEnabled;
}

// If using cloud map, do not set options.styles
if (configuration.cloudMapId == null) {
options.styles = styles;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this code moved?

@@ -1,3 +1,7 @@
## 0.5.15
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a bugfix of a pre-1.0 package, it should be 0.5.14+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Maps cloud-based styling (map ID) not applied on the web
3 participants