Skip to content

[google_maps_flutter] Fix add-marker crash on Android#11061

Merged
auto-submit[bot] merged 1 commit intoflutter:mainfrom
stuartmorgan-g:maps-android-add-marker-crash-fix
Feb 19, 2026
Merged

[google_maps_flutter] Fix add-marker crash on Android#11061
auto-submit[bot] merged 1 commit intoflutter:mainfrom
stuartmorgan-g:maps-android-add-marker-crash-fix

Conversation

@stuartmorgan-g
Copy link
Collaborator

Fixes a regression introduced with advanced marker support where the native code was assuming a non-null marker type, but the Dart code was not enforcing that, and assumed that all configurations explicitly set a marker type.

This is now enforced at the Pigeon level, with a default value set in Dart. I also added annotations on the native side to make it explicit that the marker type is suppposed to be non-null now, instead of it being an implicit requirement of the implementation of the switch statement.

Fixes flutter/flutter#182540

Pre-Review Checklist

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

Fixes a regression introduced with advanced marker support where the
native code was assuming a non-null marker type, but the Dart code was
not enforcing that, and assumed that all configurations explicitly set a
marker type.

This is now enforced at the Pigeon level, with a default value set in
Dart. I also added annotations on the native side to make it explicit
that the marker type is suppposed to be non-null now, instead of it
being an implicit requirement of the implementation of the switch
statement.

Fixes flutter/flutter#182540
@stuartmorgan-g
Copy link
Collaborator Author

We could of course fix this locally in the switch on the Java side instead, keeping everything nullable, but it seemed both clearer and safer to me to handle this on the Dart side and just never allow null across the boundary.

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 effectively addresses a crash on Android when adding markers by enforcing that the marker type is non-null. The fix is well-implemented across the Dart and native Android code, with a safe default provided on the Dart side and explicit @NonNull annotations and runtime checks on the Java side. The related tests have been updated correctly, and a new test has been added to verify the default behavior, which is great. I have one suggestion regarding the manual edits in a generated file to improve long-term maintainability.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 19, 2026
@auto-submit auto-submit bot merged commit 9b9e564 into flutter:main Feb 19, 2026
81 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 23, 2026
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Feb 23, 2026
flutter/packages@9da22bf...12b43a1

2026-02-20 rick.hohler@gmail.com [webview_flutter_wkwebview] Fix crash
when calling setOnConsoleMessage multiple times (flutter/packages#10922)
2026-02-20 engine-flutter-autoroll@skia.org Manual roll Flutter from
c023e5b to 91b2d41 (31 revisions) (flutter/packages#11088)
2026-02-20 kallentu@google.com [rfw] Remove old TODOs for code block
languages. (flutter/packages#11080)
2026-02-20 matt.boetger@gmail.com [google_maps_flutter] Remove
usesCleartextTraffic (flutter/packages#11079)
2026-02-20 stuartmorgan@google.com [google_maps_flutter] Improve iOS
shared code validation (flutter/packages#11070)
2026-02-20 mdebbar@google.com Revert "#167410: _initCalled completed
twice (#9694)" (flutter/packages#11084)
2026-02-20 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump androidx.activity:activity from 1.12.2 to 1.12.4 in
/packages/image_picker/image_picker_android/android
(flutter/packages#11033)
2026-02-20 matt.boetger@gmail.com [interactive_media_ads] Remove
usesCleartextTraffic (flutter/packages#11065)
2026-02-19 matt.boetger@gmail.com [image_picker] Remove
usesCleartextTraffic (flutter/packages#11076)
2026-02-19 matt.boetger@gmail.com [quick_actions_android] Remove
deprecated usesCleartextTraffic (flutter/packages#11063)
2026-02-19 matt.boetger@gmail.com [quick_actions] Remove
usesCleartextTraffic (flutter/packages#11064)
2026-02-19 matt.boetger@gmail.com [google_maps_flutter_android] Remove
usesCleartextTraffic (flutter/packages#11078)
2026-02-19 louisehsu@google.com [google_maps_flutter_ios] Migrate to
UIScene (flutter/packages#11001)
2026-02-19 matt.boetger@gmail.com [image_picker_android] Remove
deprecated usesCleartextTraffic (flutter/packages#11059)
2026-02-19 matt.boetger@gmail.com [file_selector_android] Remove
deprecated usesCleartextTraffic (flutter/packages#11057)
2026-02-19 matt.boetger@gmail.com [webview_flutter_android] Remove
usesCleartextTraffic (flutter/packages#11066)
2026-02-19 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump exoplayer_version from 1.9.1 to 1.9.2 in
/packages/video_player/video_player_android/android
(flutter/packages#10985)
2026-02-19 stuartmorgan@google.com [google_maps_flutter] Fix add-marker
crash on Android (flutter/packages#11061)
2026-02-19 42980667+srivats22@users.noreply.github.com #167410:
_initCalled completed twice (flutter/packages#9694)

If this roll has caused a breakage, revert this CL and stop the roller
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
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 p: google_maps_flutter platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[google_maps_flutter_android:2.19.0] NullPointerException

2 participants