-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Null safety broken for method isMarkerInfoWindowShown #78426 #3724
Conversation
The method isMarkerInfoWindowShown in file method_channel_google_maps_flutter.dart isn't working with null safety because the channel(mapId).invokeMethod has an optional return type, so forcing it to bool doesn't work. In the original code a cast has been added to silence the compiler warnings but there is a runtime error when the method is invoked because the signature invokeMethod should be invokeMethod<bool?>.
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
@googlebot I signed it! |
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, this was generated by the migration tool; I wonder why it generated that. Thanks for the contribution!
Please add a test that exercises this codepath (i.e., that fails without your fix and passes with it) per Flutter PR policy and the PR template checklist. This will also need a version and CHANGELOG update per the checklist (in the future, please don't delete the checklist when opening a PR; it's there to help smooth the process).
...ps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
...ps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
Code updated with suggested changes
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
@googlebot I fixed it |
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
Thanks for the version update! Are you planning on adding the test coverage as well, or do you need feedback on something first? |
|
Missing CLA for |
Sincerely I don't understand either, I was surprised it asked me to sign the CLA again... |
I've tried but I've not been able to find the right test where to put the logic, because most of the tests use a fakeGoogleMap instead of the real one, so I'm unable to reproduce the problem that I've discovered while building a real app... |
The "Updated version and changelog" commit appears to be using a different email address; notice that it doesn't have your profile image. You probably need to ammend that commit locally to use this account's email address, and then force push. |
| description: A Flutter plugin for integrating Google Maps in iOS and Android applications. | ||
| homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter | ||
| version: 2.0.1 | ||
| version: 2.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I hadn't looked at this closely enough; you've updated the version and changelog of the app-facing package, rather than the platform interface package where you made the change. You need to update the version of the package that your changes are in.
The test should go in this group. Currently there are no realy tests there it looks like (just a placeholder that should be removed), but you can look at, e.g., this to see what a test that sets mock method channel data looks like. |
|
@stefalda can be this problem related also to issue #78856? thanks |
Yes, I guess that it could be the same problem just in another method call |
|
Since this is a more general problem, I'll follow up shortly with a PR that tests all of the APIs that could have this issue, and fixes all of them, which will replace this one. |
|
Closing in favor of #3754. Thanks for the clear issue report, debugging, and PR, which definitely accelerated the fix here! |
The method isMarkerInfoWindowShown in file method_channel_google_maps_flutter.dart isn't working with null safety because the channel(mapId).invokeMethod has an optional return type (<T?>), so forcing it to bool doesn't work.
In the original code a cast has been added to silence the compiler warnings but there is a runtime error when the method is invoked because the signature invokeMethod should be invokeMethod<bool?>.
This is a fix for issue 78426 where there's the original code.