Skip to content

Comments

[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
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