-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/plugins
#3754Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurep: mapsGoogle Maps pluginGoogle Maps pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.waiting for PR to land (fixed)A fix is in flightA fix is in flight
Description
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?>:
This is the original implementation
@override
Future<bool> isMarkerInfoWindowShown(
MarkerId markerId, {
required int mapId,
}) {
assert(markerId != null);
return channel(mapId).invokeMethod<bool>('markers#isInfoWindowShown',
<String, String>{'markerId': markerId.value}) as Future<bool>;
}
This is a proposed fix for the implementation:
@override
Future<bool> isMarkerInfoWindowShown(
MarkerId markerId, {
required int mapId,
}) async {
assert(markerId != null);
bool? res = await channel(mapId).invokeMethod<bool?>('markers#isInfoWindowShown',
<String, String>{'markerId': markerId.value}) ;
return res!;
}
After some comments the new fix implementation schould be
@override
Future<bool> isMarkerInfoWindowShown(
MarkerId markerId, {
required int mapId,
}) async {
assert(markerId != null);
return (await channel(mapId).invokeMethod<bool>('markers#isInfoWindowShown',
<String, String>{'markerId': markerId.value}))! ;
}
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurep: mapsGoogle Maps pluginGoogle Maps pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.waiting for PR to land (fixed)A fix is in flightA fix is in flight