Skip to content

[google_maps_flutter] Add onPointOfInterestTap platform implementations - #12880

Merged
auto-submit[bot] merged 3 commits into
flutter:mainfrom
tenninebt:google-maps-poi-android
Sep 24, 2026
Merged

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

Conversation

@tenninebt

@tenninebt tenninebt commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

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

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the AI contribution guidelines and understand my responsibilities, or I am not using AI tools.
  • I read the Tree Hygiene page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter.
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I linked to at least one issue that this PR fixes in the description above.
  • I followed the version and CHANGELOG instructions, using semantic versioning and the repository CHANGELOG style.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.

@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 (POI) on the map in the google_maps_flutter_android plugin. The changes include updating the Android implementation to handle POI clicks, adding the necessary Pigeon messaging definitions, and updating the platform interface and tests to support the new event. A review comment suggests adding a null check for the PointOfInterest object in the GoogleMapController to improve robustness.

Comment on lines +389 to +395
@Override
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

To prevent potential NullPointerExceptions, it is safer to perform a null check on pointOfInterest before accessing its properties, especially since it is a parameter received from an external SDK and Java does not have compile-time null safety.

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

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

Please do not put GitHub username references in PR descriptions; that becomes the commit message, and it causes a huge amount of spam for those users over time as people update forks that include the commit.

Also, pinging individual people is not how reviews are assigned. We have a triage process.

@stuartmorgan-g stuartmorgan-g added the triage-android Should be looked at in Android triage label Sep 16, 2026
@tenninebt

Copy link
Copy Markdown
Contributor Author

Please do not put GitHub username references in PR descriptions; that becomes the commit message, and it causes a huge amount of spam for those users over time as people update forks that include the commit.

Also, pinging individual people is not how reviews are assigned. We have a triage process.

Yeah you're right, won't happen again.

Android, iOS (sdk9/sdk10), and web implementations for the published
platform interface 2.17.0 stream.
@tenninebt
tenninebt force-pushed the google-maps-poi-android branch from 3264bab to 2592be4 Compare September 18, 2026 01:03
@tenninebt tenninebt changed the title [google_maps_flutter_android] Add onPointOfInterestTap support [google_maps_flutter] Add onPointOfInterestTap platform implementations Sep 18, 2026
@tenninebt
tenninebt marked this pull request as draft September 18, 2026 01:04
@tenninebt
tenninebt marked this pull request as ready for review September 18, 2026 01:05

@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 the Android, iOS, and Web implementations of the google_maps_flutter plugin. It introduces POI tap event handling, updates the platform interface, generates Pigeon messaging bindings, and adds corresponding unit and integration tests. Feedback on the changes suggests defensively checking for a null PointOfInterest parameter in the Android onPoiClick method to prevent a potential NullPointerException, along with adding a unit test to verify this behavior.

Comment on lines +389 to +395
@Override
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

To prevent a potential NullPointerException, we should defensively check if pointOfInterest is null before accessing its properties.

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

Comment on lines +274 to +282
@Test
public void OnPoiClickNullPlaceIdDoesNotCallFlutterApi() {
GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies();
googleMapController.onMapReady(mockGoogleMap);

googleMapController.onPoiClick(new PointOfInterest(new LatLng(0, 0), null, "Test Place"));

verify(flutterApi, times(0)).onPointOfInterestTap(any(), any());
}

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

Add a unit test to verify that onPoiClick safely handles a null PointOfInterest parameter without throwing a NullPointerException.

  @Test
  public void OnPoiClickNullPlaceIdDoesNotCallFlutterApi() {
    GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies();
    googleMapController.onMapReady(mockGoogleMap);

    googleMapController.onPoiClick(new PointOfInterest(new LatLng(0, 0), null, "Test Place"));

    verify(flutterApi, times(0)).onPointOfInterestTap(any(), any());
  }

  @Test
  public void OnPoiClickNullPoiDoesNotCallFlutterApi() {
    GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies();
    googleMapController.onMapReady(mockGoogleMap);

    googleMapController.onPoiClick(null);

    verify(flutterApi, times(0)).onPointOfInterestTap(any(), any());
  }

@mdebbar
mdebbar self-requested a review September 21, 2026 15:04

@mdebbar mdebbar 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.

Web changes look good to me!

@camsim99 camsim99 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.

Android LGTM

@stuartmorgan-g stuartmorgan-g removed the triage-android Should be looked at in Android triage label Sep 22, 2026
@mdebbar mdebbar added the CICD Run CI/CD label Sep 22, 2026
@flutter-dashboard

Copy link
Copy Markdown

This pull request is not mergeable in its current state, likely because of a merge conflict. Pre-submit CI jobs were not triggered. Pushing a new commit to this branch that resolves the issue will result in pre-submit jobs being scheduled.

tileOverlaysController = TileOverlaysController(
mapView: mapView,
tileProvider: dartCallbackHandler
tileProvider: (callbackHandler as? MapsCallbackApi)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The tile provider needs to be a parameter to this init method now, not something that relies on callers passing a specific implementation type.

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 — tileProvider is now its own init parameter. Convenience inits create one MapsCallbackApi and pass it for both that and callbackHandler.

mapView: mapView,
tileProvider: dartCallbackHandler
tileProvider: (callbackHandler as? MapsCallbackApi)
?? MapsCallbackApi(binaryMessenger: binaryMessenger, messageChannelSuffix: pigeonSuffix)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should never be making a second instance of the API handlers that's only partially used; that would make understanding call flows extremely confusing.

Also, this won't actually do anything. The tile provider is weakly owned by the overlay controller, so this is deallocated essentially immediately.

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.

Yeah, that fallback was wrong on both counts. Removed it — no second handler instance anymore.

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 24, 2026
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

I cannot review code that is failing the CLA check. If you are the author of the code you pushed, you need to amend your commit to list yourself, using the email address you signed the CLA with, as the author, and then force-push.

@tenninebt
tenninebt force-pushed the google-maps-poi-android branch from 516bc3f to d2e6e81 Compare September 24, 2026 15:25
Make placeId a read-only JS interop getter, and take tileProvider as an
explicit GoogleMapController init parameter instead of casting or creating
a second MapsCallbackApi.
@tenninebt
tenninebt force-pushed the google-maps-poi-android branch from d2e6e81 to 0dad398 Compare September 24, 2026 15:25
@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label Sep 24, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 24, 2026
@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label Sep 24, 2026

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

iOS LGTM

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2026
@auto-submit
auto-submit Bot merged commit 071775b into flutter:main Sep 24, 2026
14 checks passed
pull Bot pushed a commit to fucheng-guo-sun/flutter that referenced this pull request Sep 25, 2026
…r#193351)

flutter/packages@431ea69...e55e7ac

2026-09-25 50643541+Mairramer@users.noreply.github.com [material_ui] Add
labelTextDirection handling in InputDecorator (flutter/packages#12607)
2026-09-24 tarrinneal@gmail.com [pigeon] Fix NSnumber edge cases and
null value bug (flutter/packages#12997)
2026-09-24 50643541+Mairramer@users.noreply.github.com [camera] add
custom path ouput to recording (flutter/packages#11774)
2026-09-24 jessiewong401@gmail.com [Android 17] Update packages CI test
runners to SDK 37 (flutter/packages#12376)
2026-09-24 21270878+elliette@users.noreply.github.com
[pigeon][video_player] Disable `video_player` and `pigeon` flakes
blocking latest flutter -> packages roll (flutter/packages#13003)
2026-09-24 5684363+tenninebt@users.noreply.github.com
[google_maps_flutter] Add onPointOfInterestTap platform implementations
(flutter/packages#12880)

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 flutter-ecosystem@google.com 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:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
tenninebt added a commit to tenninebt/packages that referenced this pull request Sep 26, 2026
Expose the POI tap callback on GoogleMap now that platform
implementations from flutter#12880 are published.
tenninebt added a commit to tenninebt/packages that referenced this pull request Sep 26, 2026
Expose the POI tap callback on GoogleMap now that platform
implementations from flutter#12880 are published.
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.

4 participants