Skip to content

[google_maps_flutter] Add onPointOfInterestTap - #11872

Merged
auto-submit[bot] merged 3 commits into
flutter:mainfrom
tenninebt:google-maps-on-poi-tap
Oct 14, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:mainfrom
tenninebt:google-maps-on-poi-tap

Conversation

@tenninebt

@tenninebt tenninebt commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Adds GoogleMap.onPointOfInterestTap, a callback that fires when the user taps a built-in map point of interest. The callback receives a PointOfInterestId containing the place ID only, matching maintainer feedback on #4052 and #10963.

The change is wired through the federated plugin stack: platform_interface (type + event stream), Android (OnPoiClickListener), iOS including sdk9/sdk10/shared (didTapPOIWithPlaceID), web (IconMouseEvent.placeId on map click), and the app-facing google_maps_flutter package. Tests cover Dart unit tests, Android Robolectric, iOS native, and web integration tests in the web example.

Fixes flutter/flutter#60695

Pre-Review Checklist

@tenninebt
tenninebt force-pushed the google-maps-on-poi-tap branch 9 times, most recently from 336fb13 to e125948 Compare June 13, 2026 07:30
@tenninebt
tenninebt marked this pull request as ready for review June 13, 2026 07:31

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

Copy link
Copy Markdown
Contributor

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 adds support for tapping points of interest (POIs) on the map across Android, iOS, and Web platforms in the google_maps_flutter plugin. It introduces the PointOfInterestId type and PointOfInterestTapEvent in the platform interface, exposes the onPointOfInterestTap callback on the GoogleMap widget, and implements the platform-specific event handling and Pigeon messaging. The review feedback suggests adding a defensive null check for the PointOfInterest parameter in the Android onPoiClick handler to prevent a potential NullPointerException.

Comment on lines +390 to +395
public void onPoiClick(PointOfInterest pointOfInterest) {
if (pointOfInterest.placeId != null) {
flutterApi.onPointOfInterestTap(
pointOfInterest.placeId, (Result<Unit> result) -> Unit.INSTANCE);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Defensively checking pointOfInterest for null before accessing its properties is a good practice to prevent potential NullPointerExceptions, especially since the parameter is not annotated with @NonNull.

Suggested change
public void onPoiClick(PointOfInterest pointOfInterest) {
if (pointOfInterest.placeId != null) {
flutterApi.onPointOfInterestTap(
pointOfInterest.placeId, (Result<Unit> result) -> Unit.INSTANCE);
}
}
public void onPoiClick(PointOfInterest pointOfInterest) {
if (pointOfInterest != null && pointOfInterest.placeId != null) {
flutterApi.onPointOfInterestTap(
pointOfInterest.placeId, (Result<Unit> result) -> Unit.INSTANCE);
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The placeId null guard is the important part, and it’s already there. The Maps SDK only calls onPoiClick with a non-null PointOfInterest when a POI is tapped, and the other click handlers in this class don’t null-check their parameters either. We already have a test for the realistic case (placeId == null), which matches iOS. An extra pointOfInterest != null check would be harmless but unnecessary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fair enough.

@stuartmorgan-g
stuartmorgan-g self-requested a review June 23, 2026 18:26
@tenninebt

Copy link
Copy Markdown
Contributor Author

Hi @stuartmorgan-g when you're ready to review ping me and I'll do it right away. I'd rather fix the conflicts onces and for all instead of doing it every commit on that part of the code ;).

@stuartmorgan-g

stuartmorgan-g commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

No need to resolve changelog/pubspec comments until the whole review process is essentially complete (per the FAQ) since the conflicts in those files don't affect the ability to review the changes.

- (void)didLongPressAtPosition:(FGMPlatformLatLng *)position;

/// Called when a point of interest is tapped.
- (void)didTapPointOfInterestWithPlaceId:(NSString *)placeId;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

...WithPlaceIdentifier:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed. I also moved the declaration up so it sits in the same spot as the matching method in MapsCallbackApi.

void onCircleTap(String circleId);

/// Called when a point of interest is tapped.
@ObjCSelector('didTapPointOfInterestWithPlaceId:')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

...PlaceIdentifier:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, it's didTapPointOfInterestWithPlaceIdentifier: now.

@tenninebt
tenninebt force-pushed the google-maps-on-poi-tap branch 4 times, most recently from 2247d7a to 1215581 Compare July 30, 2026 16:33
@tenninebt
tenninebt requested a review from stuartmorgan-g July 30, 2026 16:36
@stuartmorgan-g stuartmorgan-g added triage-ios Should be looked at in iOS triage triage-android Should be looked at in Android triage labels Aug 10, 2026
@stuartmorgan-g stuartmorgan-g added the federated: all_changes PR that contains changes for all packages for a federated plugin change label Aug 10, 2026
@tenninebt

Copy link
Copy Markdown
Contributor Author

Implementations didn't need to each be separate PRs from each other, but since you've opened them already we can proceed that way.

Would rather have me update this PR? (I can still close the others if it is more convenient for you guys.)

@stuartmorgan-g

stuartmorgan-g commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Please see https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins. This PR contains both implementation packages and the app-facing package, so cannot land this way. The flow we recommend for a change like this is the one described there, which involves three total PRs.

@tenninebt

tenninebt commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Please see https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins. This PR contains both implementation packages and the app-facing package, so cannot land this way. The flow we recommend for a change like this is the one described there, which involves three total PRs.

Got it, I closed the 2 draft PRs and used the following for the implementations: #12880

auto-submit Bot pushed a commit that referenced this pull request Sep 24, 2026
…ns (#12880)

## Summary

- Platform implementations of `onPointOfInterestTap` for **Android**, **iOS** (`sdk9` / `sdk10` + shared source), and **web**
- Depends on published `google_maps_flutter_platform_interface` 2.17.0 from #12752
- Federated implementations PR (per [Changing federated plugins](https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins)); app-facing package will follow in a separate PR

**Notes**
- Frozen `google_maps_flutter_ios` is intentionally unchanged (no new features per that package’s README); iOS support is in `google_maps_flutter_ios_sdk9` / `google_maps_flutter_ios_sdk10`
- iOS DI follows the Swift controller conventions (required `callbackHandler` on the designated initializer)

Supersedes the separate drafts #12881 (web) and #12882 (iOS).

Part of #11872 / flutter/flutter#60695.

## Pre-Review Checklist
@hellohuanlin

Copy link
Copy Markdown
Contributor

@tenninebt could you resolved the conflict and rebase? thanks

Expose the POI tap callback on GoogleMap now that platform
implementations from flutter#12880 are published.
@tenninebt
tenninebt force-pushed the google-maps-on-poi-tap branch from 954c841 to f71e8e8 Compare September 26, 2026 17:34
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 26, 2026
@tenninebt tenninebt changed the title [google_maps_flutter] Add onPointOfInterestTap callback [google_maps_flutter] Add onPointOfInterestTap Sep 26, 2026
/// Called when a point of interest on the map is tapped.
///
/// Supported on Android and web, and on iOS when using
/// `google_maps_flutter_ios_sdk9` or `google_maps_flutter_ios_sdk10`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment does not belong in this package; it will become incorrect when, inevitably, new _sdk* variants are introduced that also support this feature.

It should simply say that it may not be supported on all implementations. A note about google_maps_flutter_ios not supporting a feature belongs in the google_maps_flutter_ios README, not here.

///
/// Supported on Android and web, and on iOS when using
/// `google_maps_flutter_ios_sdk9` or `google_maps_flutter_ios_sdk10`.
/// The default `google_maps_flutter_ios` package does not receive new

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When the endorsed implementation is changed, there is essentially no chance that the person making that change would remember the existence of this comment, so this also does not belong here.

* Adds support for tapping points of interest on the map.
On iOS, this requires `google_maps_flutter_ios_sdk9` or
`google_maps_flutter_ios_sdk10` (the default `google_maps_flutter_ios`
package does not receive new features).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(This is fine, since CHANGELOG entries are not expected to be evergreen.)

@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label Sep 28, 2026
Keep app-facing dartdoc generic, and document that the frozen iOS
implementation does not support the callback in its own README.
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 29, 2026
@@ -1,5 +1,7 @@
## NEXT

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

README changes need versioning, as noted in the contributing docs.

For example, `GoogleMap.onPointOfInterestTap` is not supported here; use
[`google_maps_flutter_ios_sdk9`](https://pub.dev/packages/google_maps_flutter_ios_sdk9)
or
[`google_maps_flutter_ios_sdk10`](https://pub.dev/packages/google_maps_flutter_ios_sdk10).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The previous sentence already linked down to the section of this README that has the same links; we don't want two copies of the same content in one README.

README changes must be published. Drop the duplicate SDK links and
release the note as 2.18.7, folding the existing NEXT entry in.
@LouiseHsu
LouiseHsu requested a review from vashworth October 8, 2026 21:39
@LouiseHsu
LouiseHsu dismissed stuartmorgan-g’s stale review October 8, 2026 21:40

dismissed from triage :D

@vashworth vashworth added the CICD Run CI/CD label Oct 14, 2026
@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 14, 2026
@auto-submit
auto-submit Bot merged commit 84f9f8e into flutter:main Oct 14, 2026
13 checks passed
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Oct 15, 2026
Roll Packages from a1ed23c to da40eaf (33 revisions)

flutter/packages@a1ed23c...da40eaf

2026-10-15 [email protected] [pigeon]add support for sealed classes
in native interop (flutter/packages#13175)
2026-10-15 [email protected] [pigeon] Replace full JNI bindings with
stubs for API classes that aren't needed (flutter/packages#13173)
2026-10-14 [email protected] [material_ui] Fix
self-comparison and assert bugs in semantics_tester
(flutter/packages#12722)
2026-10-14 [email protected] [camera_avfoundation] Replace the
deprecated 'videoOrientation' with 'videoRotationAngle' on iOS 17+
(flutter/packages#13247)
2026-10-14 [email protected] [material_ui] Fix GridTile crash when the
incoming constraints are unbounded (flutter/packages#12586)
2026-10-14 [email protected] [in_app_purchase_storekit] Remove unused
and deprecated "SKDownload" hosted content (flutter/packages#13222)
2026-10-14 [email protected]
[material_ui] Add supportingTextPadding to InputDecorator
(flutter/packages#12769)
2026-10-14 [email protected]
[vector_graphics_codec] Add support for encoding and decoding paint blur
commands (flutter/packages#13148)
2026-10-14 [email protected] [go_router] Fix redirect zone async error
handling (flutter/packages#12836)
2026-10-14 [email protected] Sync release-go_router-18.1.0 to
main (flutter/packages#13260)
2026-10-14 [email protected] Sync release-cupertino_ui-1.1.3 to
main (flutter/packages#13258)
2026-10-14 [email protected] [material_ui] add enableInlinePrediction
parameter to TextFormField (flutter/packages#12793)
2026-10-14 [email protected] Sync release-material_ui-1.7.0 to
main (flutter/packages#13259)
2026-10-14 [email protected] [material_ui] Add the
Material shapes. (flutter/packages#12771)
2026-10-14 [email protected] [material_ui]
Add tertiary tap callbacks to InkResponse and InkWell
(flutter/packages#12676)
2026-10-14 [email protected] Roll Flutter from
4249ccb to 426be96 (44 revisions) (flutter/packages#13256)
2026-10-14 [email protected] [material_ui]
fixes expanded state in the a11y_assessment home page dropdown
(flutter/packages#13219)
2026-10-14 [email protected] [VPAT] Fix semantics in
a11y_assessments drawer, radio, and rail demos (flutter/packages#13159)
2026-10-14 [email protected]
[google_maps_flutter] Add onPointOfInterestTap (flutter/packages#11872)
2026-10-14 [email protected] [go_router] Fix shell route key collisions
and dynamic branch updates (flutter/packages#12549)
2026-10-14 [email protected] Manual roll Flutter from
d03768e to 4249ccb (158 revisions) (flutter/packages#13220)
2026-10-14 [email protected] [image_picker_ios] Require Flutter
3.47 / iOS 15 and drop deprecated kUTType code paths
(flutter/packages#13224)
2026-10-13 [email protected] [in_app_purchase_storekit] Fixes
Storekit 2 flaky tests (flutter/packages#13213)
2026-10-13 [email protected] [local_auth] Convert Android to new
Pigeon suspend support (flutter/packages#12894)
2026-10-13 [email protected] [material_ui] Add
enabled parameter to DropdownButtonFormField (flutter/packages#12610)
2026-10-13 [email protected] [go_router] Link ShellRoute docs to
StatefulShellRoute (flutter/packages#13120)
2026-10-13 [email protected] FadeForwards page transition
performance (flutter/packages#13161)
2026-10-13 [email protected]
[in_app_purchase_android] Guard async billing callbacks against
duplicate listener responses (flutter/packages#12640)
2026-10-13 [email protected] [google_sign_in] Remove the
Objective-C exception catcher (flutter/packages#13156)
2026-10-13 [email protected] [camera_avfoundation] Remove availability
checks below the package minimum iOS 13 (flutter/packages#13214)
2026-10-13 [email protected] [google_maps_flutter_ios] Remove iOS 14
availability check from example UI tests (flutter/packages#13218)
2026-10-13 [email protected] [google_sign_in] Convert
implementation to Kotlin (flutter/packages#13005)
2026-10-13 [email protected] [image_picker_ios] PR 2/5 Add a
PHImageManager image-data seam and migrate plugin native tests to Swift
Testing (flutter/packages#13079)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
Roll Packages from a1ed23c to da40eaf (33 revisions)

flutter/packages@a1ed23c...da40eaf

2026-10-15 [email protected] [pigeon]add support for sealed classes
in native interop (flutter/packages#13175)
2026-10-15 [email protected] [pigeon] Replace full JNI bindings with
stubs for API classes that aren't needed (flutter/packages#13173)
2026-10-14 [email protected] [material_ui] Fix
self-comparison and assert bugs in semantics_tester
(flutter/packages#12722)
2026-10-14 [email protected] [camera_avfoundation] Replace the
deprecated 'videoOrientation' with 'videoRotationAngle' on iOS 17+
(flutter/packages#13247)
2026-10-14 [email protected] [material_ui] Fix GridTile crash when the
incoming constraints are unbounded (flutter/packages#12586)
2026-10-14 [email protected] [in_app_purchase_storekit] Remove unused
and deprecated "SKDownload" hosted content (flutter/packages#13222)
2026-10-14 [email protected]
[material_ui] Add supportingTextPadding to InputDecorator
(flutter/packages#12769)
2026-10-14 [email protected]
[vector_graphics_codec] Add support for encoding and decoding paint blur
commands (flutter/packages#13148)
2026-10-14 [email protected] [go_router] Fix redirect zone async error
handling (flutter/packages#12836)
2026-10-14 [email protected] Sync release-go_router-18.1.0 to
main (flutter/packages#13260)
2026-10-14 [email protected] Sync release-cupertino_ui-1.1.3 to
main (flutter/packages#13258)
2026-10-14 [email protected] [material_ui] add enableInlinePrediction
parameter to TextFormField (flutter/packages#12793)
2026-10-14 [email protected] Sync release-material_ui-1.7.0 to
main (flutter/packages#13259)
2026-10-14 [email protected] [material_ui] Add the
Material shapes. (flutter/packages#12771)
2026-10-14 [email protected] [material_ui]
Add tertiary tap callbacks to InkResponse and InkWell
(flutter/packages#12676)
2026-10-14 [email protected] Roll Flutter from
4249ccb to 426be96 (44 revisions) (flutter/packages#13256)
2026-10-14 [email protected] [material_ui]
fixes expanded state in the a11y_assessment home page dropdown
(flutter/packages#13219)
2026-10-14 [email protected] [VPAT] Fix semantics in
a11y_assessments drawer, radio, and rail demos (flutter/packages#13159)
2026-10-14 [email protected]
[google_maps_flutter] Add onPointOfInterestTap (flutter/packages#11872)
2026-10-14 [email protected] [go_router] Fix shell route key collisions
and dynamic branch updates (flutter/packages#12549)
2026-10-14 [email protected] Manual roll Flutter from
d03768e to 4249ccb (158 revisions) (flutter/packages#13220)
2026-10-14 [email protected] [image_picker_ios] Require Flutter
3.47 / iOS 15 and drop deprecated kUTType code paths
(flutter/packages#13224)
2026-10-13 [email protected] [in_app_purchase_storekit] Fixes
Storekit 2 flaky tests (flutter/packages#13213)
2026-10-13 [email protected] [local_auth] Convert Android to new
Pigeon suspend support (flutter/packages#12894)
2026-10-13 [email protected] [material_ui] Add
enabled parameter to DropdownButtonFormField (flutter/packages#12610)
2026-10-13 [email protected] [go_router] Link ShellRoute docs to
StatefulShellRoute (flutter/packages#13120)
2026-10-13 [email protected] FadeForwards page transition
performance (flutter/packages#13161)
2026-10-13 [email protected]
[in_app_purchase_android] Guard async billing callbacks against
duplicate listener responses (flutter/packages#12640)
2026-10-13 [email protected] [google_sign_in] Remove the
Objective-C exception catcher (flutter/packages#13156)
2026-10-13 [email protected] [camera_avfoundation] Remove availability
checks below the package minimum iOS 13 (flutter/packages#13214)
2026-10-13 [email protected] [google_maps_flutter_ios] Remove iOS 14
availability check from example UI tests (flutter/packages#13218)
2026-10-13 [email protected] [google_sign_in] Convert
implementation to Kotlin (flutter/packages#13005)
2026-10-13 [email protected] [image_picker_ios] PR 2/5 Add a
PHImageManager image-data seam and migrate plugin native tests to Swift
Testing (flutter/packages#13079)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD federated: all_changes PR that contains changes for all packages for a federated plugin change p: google_maps_flutter platform-ios triage-android Should be looked at in Android triage triage-ios Should be looked at in iOS triage triage-web Should be looked at in web triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[google_maps_flutter] Add callback for click on google poi's on the map

7 participants