Skip to content

Comments

[google_maps_flutter_ios] Add Advanced marker support#10508

Open
jokerttu wants to merge 5 commits intoflutter:mainfrom
CodemateLtd:feature/advanced_markers_google_maps_flutter_ios
Open

[google_maps_flutter_ios] Add Advanced marker support#10508
jokerttu wants to merge 5 commits intoflutter:mainfrom
CodemateLtd:feature/advanced_markers_google_maps_flutter_ios

Conversation

@jokerttu
Copy link
Contributor

@jokerttu jokerttu commented Nov 24, 2025

This PR adds Advanced markers support to the iOS implementation of google_maps_flutter.
Approved combined PR: #7882
Approved and merged platform interface PR: #9737
Issue: flutter/flutter#155526

Blocker:
GMSAdvancedMarker is not rendered when the marker icon is a GMSPinImage instance. Tracking issue:
https://issuetracker.google.com/issues/370536110

Pre-Review Checklist

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

@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch from 8f811e9 to 26fd75a Compare November 24, 2025 15:16
@stuartmorgan-g
Copy link
Collaborator

Picking up the discussion from the main issue here: do you have a link to the tracking issue for the blocker here ("an issue with the GMSPinImage not rendering on the map", per this comment)? As noted in that discussion, the link is to a long-closed issue.

@jokerttu
Copy link
Contributor Author

jokerttu commented Jan 8, 2026

Picking up the discussion from the main issue here: do you have a link to the tracking issue for the blocker here ("an issue with the GMSPinImage not rendering on the map", per this comment)? As noted in that discussion, the link is to a long-closed issue.

Added tracking issue information to this PR description:
https://issuetracker.google.com/issues/474141340
Edit: the "long-closed issue" is now re-opened: https://issuetracker.google.com/issues/370536110

@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch 3 times, most recently from 16c74d8 to df35a62 Compare January 14, 2026 14:08
@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch 2 times, most recently from 2c08201 to b1b0038 Compare February 18, 2026 16:57
@jokerttu
Copy link
Contributor Author

jokerttu commented Feb 19, 2026

@stuartmorgan-g
As this iOS implementation package still has an issue with Advanced Marker rendering when the marker icon is created using PinConfig (tracked here: https://issuetracker.google.com/issues/370536110).

Note that Advanced Markers without any customizations (without PinConfig icon type), or those using a custom image asset, render correctly. The issue only affects markers that use GMSPinImage to customize the marker in native iOS code.

We could still publish, but it must be clearly communicated to developers that PinConfig icons are not supported and are affected by this issue. (Related comment at #7882 (comment))

Since PinConfig and AdvancedMarker are defined in packages/google_maps_flutter/google_maps_flutter_platform_interface (and not in this iOS implementation package), what would be the best place to document this behavior so that Devs really are aware of this?

Option 1:
Add an assert in _platformMarkerFromMarker conversion method to ensure marker.icon is not PinConfig.

Option 2:
Throw an UnsupportedError in _platformMarkerFromMarker conversion method if marker.icon is PinConfig.

Option 3:
Just log a warning to the console.
(This would most likely cause unnecessary issue reports)

I’ll also create a separate issue describing the issue and link it to the code under TODO

Additionally, this should be documented in the iOS implementation package’s README.md?

@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch from b1b0038 to da25bc6 Compare February 19, 2026 15:44
@stuartmorgan-g
Copy link
Collaborator

Since PinConfig and AdvancedMarker are defined in packages/google_maps_flutter/google_maps_flutter_platform_interface (and not in this iOS implementation package), what would be the best place to document this behavior so that Devs really are aware of this?

We'll have to bypass our usual guidance against platform-specific docs in the platform interface in this case, and document it on PinConfig.

Option 1: Add an assert in _platformMarkerFromMarker conversion method to ensure marker.icon is not PinConfig.

Option 2: Throw an UnsupportedError in _platformMarkerFromMarker conversion method if marker.icon is PinConfig.

Option 3: Just log a warning to the console. (This would most likely cause unnecessary issue reports)

I don't think we should do anything at a code level, because the behavior isn't in code that we control. Let's say we ship an UnsupportedError... then a week later, a bugfix release of the Google Maps iOS SDK goes out that fixes the issue. Now google_maps_flutter is broken even though the SDK isn't.

I think we should just put a prominent comment on the PinConfig class and constructor, and on the pinConfig factory method. We should phrase it in such a way that it won't be actively wrong if we haven't removed/updated it yet once the issue is fixed; something like:

WARNING: On iOS, using a PinConfig may result in the marker not showing. For details and updates, see
https://issuetracker.google.com/issues/370536110. If this issue has not been fixed in the version of the
Google Maps SDK you are using, consider using an asset or bitmap for customization on iOS.

Additionally, this should be documented in the iOS implementation package’s README.md?

This is severe enough that I would put it here rather than in the implementation package, especially since we still mostly haven't "federated" the README platform details yet for this plugin.

@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch from da25bc6 to d8397ec Compare February 20, 2026 14:14
@jokerttu jokerttu marked this pull request as ready for review February 23, 2026 10:12
@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch from d8397ec to 6a2e5a9 Compare February 23, 2026 10:12
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 introduces advanced marker support to the iOS implementation of google_maps_flutter. It includes updates to the CHANGELOG.md, modifications to integration tests to cover advanced marker clustering and pin configurations, and new example pages demonstrating advanced marker icons and collision behavior. The core changes involve updating Pigeon messages to include PlatformMarkerCollisionBehavior and PlatformMarkerType, and modifying the FGMMarkersController to handle advanced markers based on the markerType configuration. The FGMImageUtils.m file has been updated to support PinConfig for advanced marker icons.

@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch from 7eac3ce to 911dfa1 Compare February 23, 2026 11:58
auto-submit bot pushed a commit that referenced this pull request Feb 23, 2026
#11100)

Add iOS warning for PinConfig usage in BitmapDescriptor

iOS implementation for Advanced Markers: #10508
Related issue: 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.
@jokerttu jokerttu force-pushed the feature/advanced_markers_google_maps_flutter_ios branch from 911dfa1 to 9d2bacd Compare February 23, 2026 16:49
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.

Generally looks good, just small comments.

What changes were in that last force-push? It came in when I was almost done reviewing, and since it's a force-push I can't see diffs relative to where I had reviewed.

@import UIKit;

#import "FGMAssetProvider.h"
#import "FGMConversionUtils.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this import needed here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be reverted until we are building with SwiftPM all the time.

markerId:markerId1
clusterManagerId:clusterManagerId];
clusterManagerId:clusterManagerId
collisionBehavior:NULL];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here and below, the boxed collision behavior is an Obj-C object, so the correct value is nil, not NULL.

FGMIconFromBitmap([FGMPlatformBitmap makeWithBitmap:pinConfig], assetProvider, screenScale);

// PinConfig returns nil on iOS versions without GMSPinImageOptions support (< iOS 16.0).
// On simulators, GMSPinImage may also return a zero-dimension image. Both cases are acceptable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity, do we know why this happens in simulators, or is it just an undocumented SDK behavior?

if (cloudMapId) {
options.mapID = [GMSMapID mapIDWithIdentifier:cloudMapId];
NSString *mapId = creationParameters.mapConfiguration.mapId;
if (mapId && mapId.length > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: the mapId && is redundant here; <nil>.length is defined to return zero.

PlatformMarkerCollisionBehavior.optionalAndHidesLowerPriority,
MarkerCollisionBehavior.requiredAndHidesOptional =>
PlatformMarkerCollisionBehavior.requiredAndHidesOptional,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This must have a fallback behavior (either a default value, or null, whichever makes more sense in this case) to handle changes in the platform interface. Search for // ignore: dead_code in this file for examples to follow.

borderColor: borderColor,
),
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here; this code needs some kind of handling of the case where a new glyph type is added to the platform interface as a non-breaking change (even if it's just throwing an UnimplementedError).

return switch (markerType) {
MarkerType.marker => PlatformMarkerType.marker,
MarkerType.advancedMarker => PlatformMarkerType.advancedMarker,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs fallback handling, in case a third marker type is ever added.

final PlatformMarkerCollisionBehavior? collisionBehavior;
}

enum PlatformMarkerCollisionBehavior {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should have a comment referencing the related enum, like we do on the other classes/enums that are mirroring existing code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

All of the project changes can be reverted to reduce churn in the PR.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants