Skip to content

Conversation

@hearsilent
Copy link

@hearsilent hearsilent commented Jan 5, 2026

Implements the GoogleMap.OnMapLoadedCallback interface and triggers the onMapLoaded event via platform channels on Android and iOS, with corresponding handling on Web. Updates the generated Pigeon message files and platform interface to support the new event, enabling Flutter apps to listen for when the map has fully loaded across all supported platforms.

Fixes flutter/flutter#99610

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

Implements the GoogleMap.OnMapLoadedCallback interface and triggers the onMapLoaded event in the platform channels for both Android and iOS. Updates generated Pigeon message files and platform interface to support the new event, enabling Flutter apps to listen for when the map has fully loaded.
Introduces a new test in both Android and iOS Google Maps Flutter plugins to verify that the onMapLoaded event is sent to the correct stream for a given mapId. This ensures proper event delivery from the native side to Dart.
Updates package versions and changelogs to reflect the new feature.
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 support for the onMapLoaded callback in the google_maps_flutter plugin for both Android and iOS. The changes are well-implemented across the platform interface, Android, and iOS packages. The platform interface is correctly extended with the new MapLoadedEvent and onMapLoaded stream. The native implementations use the appropriate platform-specific callbacks (OnMapLoadedCallback for Android and mapViewDidFinishTileRendering: for iOS) and communicate with the Dart side via updated Pigeon message definitions. New tests have been added to verify the functionality on both platforms, and all relevant package versions and changelogs have been updated accordingly. The code is clean, consistent, and follows existing patterns.

@stuartmorgan-g
Copy link
Collaborator

Thanks for the contribution!

Two initial high-level notes while this waits for review:

Introduces an onMapLoaded callback to the GoogleMap widget, allowing clients to be notified when map tiles have finished loading. Updates the controller and web implementation to support the new event, adds related tests, and demonstrates usage in the example app.
Added dependency_overrides to various pubspec.yaml files across google_maps_flutter packages to enable local development and testing of federated plugins. These changes are for testing and initial review only and should not be merged into the main branch, as indicated by the included comments and reference to the Flutter contributing guidelines.
@hearsilent
Copy link
Author

Thanks for the notes!

Both points have been fully addressed:

  • The federated plugin change instructions have been followed, and CI should now run successfully.
  • Web is now handled appropriately, so clients relying on this callback will not be silently broken.

Please let me know if there’s anything else to adjust while this is under review.

@stuartmorgan-g
Copy link
Collaborator

The CI failures all look like real failures now, which will need to be resolved (other than the expected federated safety check).

Implements the onMapLoaded and onGroundOverlayTap event streams in MethodChannelGoogleMapsFlutter. Updates the changelog to reflect these additions.
Updated the test to exclude WebMapReadyEvent from the capturedEvents stream, ensuring only relevant events are considered during testing.
@hearsilent
Copy link
Author

Thanks for the heads up. All CI failures have now been resolved, except for the expected federated safety check.

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

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

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

The iOS implementation lgtm (modulo a potentially broken link).

}

@override
Stream<MapLoadedEvent> onMapLoaded({required int mapId}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not familiar with the API conventions of this package, but each event in the Stream basically carries no information so it might as well be Void. It looks to me that the MapLoadedEvent type only exists so that this implementation can use it to filter the event stream and extract the relevant events, and MapLoadedEvent is not useful to the caller of this API at all. If that's indeed the case, would it be possible to hide the MapLoadedEvent type? Or is it made public for subclassing?

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume with the current interface, to provide a "start loading" event stream in the future would require adding a new onMapLoading method to this interface. I would expect a lot of use cases of this API would also involve listening to the "Map started loading" event stream and combining the two streams (e.g., I want to perform asynchronous work on map load, and cancel that work if the map starts loading again).

IMO it might be a bit more ergonomic to return a Stream that gives you both start and finish events (so something like Stream<bool>, or the boolean flag can be added to MapLoadEvent), or even a ValueNotifier<bool> (but now the caller would have to manage the lifespan of the ValueNotifier so I'm not sure about that).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah it looks like this is a low-level interface and most app developers don't have to use this directly. Feel free to ignore the comments then.

Corrected the documentation link for GMSMapViewDelegate.mapViewDidFinishTileRendering in the GoogleMap widget to point to the updated iOS SDK reference.
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.

[google_maps_flutter] Expose an "onTilesLoaded" to notify when all tiles have been fully rendered.

4 participants