Skip to content

Conversation

@aednlaxer
Copy link
Contributor

@aednlaxer aednlaxer commented Oct 16, 2024

This PR adds Advanced Markers support to google_maps_flutter as discussed in #155526. The document from the issue offers several options to implement Advanced Markers support, this PR uses option 1 (Advanced Marker Dart class is a subclass Marker class).

Summary of changes:

  • Add map capability check
  • Add AdvancedMarker class
  • Add MarkerCollisionBehavior enum to control Advanced Marker's behavior when it collides with another marker
  • Add PinConfig bitmap descriptor for customizing Advanced Marker's pin and icon
  • Add markerType parameter to indicate that Advanced Markers should be used
  • Rename cloudMapId to mapId

Notes:

  • native implementations need to know what kind of marker should be used, this is needed to use correct marker options, cluster manager and marker controller. Indicating marker type is done by using a markerType option when creating a GoogleMap (could be marker or advancedMarker). Default option is marker
  • cloudMapId is deprecated in favor of mapId. New name follows SDKs, documentation and Cloud Console naming.
  • web implementation uses generics because gmaps.Marker and gmaps.AdvancedMarkerElement are not related to each other and should be handled differently
  • legacy markers are deprecated but still supported in Maps Javascript API. google_maps_flutter still uses them by default in this PR because of backward-compatibility. #130472 is related, package users will be able to use Advanced Markers to fix the deprecation warning
  • Advanced Markers example on iOS doesn't show advanced markers, seems to be a known issue
  • Using Flutter widget as Advanced Marker icon (so called View Marker) is not part of this PR, this was discussed in the document and later removed as we agreed that it should be a separate issue

Resolves #155526

Pre-launch Checklist

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

Copy link
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

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

High level android code review. I am concerned by having to runtime type check class.

That said thank you for opening this pull request.

@stuartmorgan-g stuartmorgan-g added the triage-ios Should be looked at in iOS triage label Nov 21, 2024
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

I've only looked at the app-facing and platform interface packages so far, but there are some fundamental structure questions at the interface layer.

Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

Overall, the Android implementation looks good to me! Left some questions regarding testing.

skip: true,
);

testWidgets('markerWithPinConfig', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this testing anything? Can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't explicitly check anything with expect(), it's similar to other marker tests (markerWithLegacyBytes, markerWithAssetMapBitmapCreate etc) which are "run it to make sure it doesn't throw an exception or fail in a different way" kind of tests

Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

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

iOS side LGTM

@bridgein

This comment was marked as off-topic.

@gmackall gmackall requested a review from camsim99 July 15, 2025 21:15
Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

Android LGTM!

@stuartmorgan-g stuartmorgan-g removed triage-ios Should be looked at in iOS triage triage-android Should be looked at in Android triage labels Jul 16, 2025
@stuartmorgan-g
Copy link
Collaborator

@aednlaxer This has high-level LGs for all components now, so please feel free to split out the platform interface PR. I'll re-review that piece here in the meantime, but any comments can be addressed in the sub-PR.

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

I re-reviewed the platform interface portion, and everything looks good there :)

auto-submit bot pushed a commit that referenced this pull request Aug 7, 2025
…#9737)

This PR adds Advanced markers support to the platform interface of `google_maps_flutter`.
Approved combined PR: #7882
Issue: [#155526](flutter/flutter#155526)

## Pre-Review Checklist

**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). 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.

[^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.
@Piinks
Copy link
Contributor

Piinks commented Sep 22, 2025

Greetings from stale PR triage! 👋
Is this change still on your radar? It looks like it has had quite the journey and a fair number of stamps, is it ready? :)

@stuartmorgan-g
Copy link
Collaborator

This is waiting on the sub-PR at #9773

@stuartmorgan-g stuartmorgan-g added the federated: all_changes PR that contains changes for all packages for a federated plugin change label Sep 24, 2025
@stuartmorgan-g
Copy link
Collaborator

@aednlaxer It looks like only web was split out; is there a reason the Android and iOS implementations weren't included in that PR (or a parallel split-out PR)?

@jokerttu
Copy link
Contributor

jokerttu commented Nov 2, 2025

@aednlaxer It looks like only web was split out; is there a reason the Android and iOS implementations weren't included in that PR (or a parallel split-out PR)?

@stuartmorgan-g Discussed with @aednlaxer and I'll take over @aednlaxer 's work, and continue splitting the next PR's.
Already rebased to the main (not pushed yet), and currently fixing issues I found with iOS implementation before creating the PR's. Should be ready soon.

@jokerttu
Copy link
Contributor

jokerttu commented Nov 7, 2025

Created split PR for Android.
I will create split-PR for iOS implementation later as draft as this known issue seems to be still visible.
I have a separate discussion open about this issue, and hopefully, I’ll get a resolution soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

federated: all_changes PR that contains changes for all packages for a federated plugin change p: google_maps_flutter platform-android platform-ios platform-web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Advanced Marker support to google_maps_flutter