From b96fe62979f1a75e47e87492ef127b37d296df82 Mon Sep 17 00:00:00 2001 From: Luis Thein Date: Sun, 28 Mar 2021 14:37:33 +0200 Subject: [PATCH] fix: Build failure after Nullability update --- CHANGELOG.md | 2 +- lib/src/controller.dart | 17 ++++++++++------- pubspec.yaml | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72233db..0b0ff73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 1.0.0 -* Adds null safety. Refresh example app. +* Adds null safety. Refresh example app (Tanks to @jonbhanson). ## 0.1.9+4 diff --git a/lib/src/controller.dart b/lib/src/controller.dart index c239d25..553ba46 100644 --- a/lib/src/controller.dart +++ b/lib/src/controller.dart @@ -1,8 +1,8 @@ part of platform_maps_flutter; class PlatformMapController { - appleMaps.AppleMapController? appleController; - googleMaps.GoogleMapController? googleController; + appleMaps.AppleMapController? appleController; + googleMaps.GoogleMapController? googleController; PlatformMapController(dynamic controller) { if (controller.runtimeType == googleMaps.GoogleMapController) { @@ -22,7 +22,8 @@ class PlatformMapController { /// * [isMarkerInfoWindowShown] to check if the Info Window is showing. Future showMarkerInfoWindow(MarkerId markerId) { if (Platform.isAndroid) { - return googleController!.showMarkerInfoWindow(markerId.googleMapsMarkerId); + return googleController! + .showMarkerInfoWindow(markerId.googleMapsMarkerId); } else if (Platform.isIOS) { return appleController! .showMarkerInfoWindow(markerId.appleMapsAnnoationId); @@ -40,7 +41,8 @@ class PlatformMapController { /// * [isMarkerInfoWindowShown] to check if the Info Window is showing. Future hideMarkerInfoWindow(MarkerId markerId) { if (Platform.isAndroid) { - return googleController!.hideMarkerInfoWindow(markerId.googleMapsMarkerId); + return googleController! + .hideMarkerInfoWindow(markerId.googleMapsMarkerId); } else if (Platform.isIOS) { return appleController! .hideMarkerInfoWindow(markerId.appleMapsAnnoationId); @@ -56,13 +58,14 @@ class PlatformMapController { /// * See also: /// * [showMarkerInfoWindow] to show the Info Window. /// * [hideMarkerInfoWindow] to hide the Info Window. - Future isMarkerInfoWindowShown(MarkerId markerId) { + Future isMarkerInfoWindowShown(MarkerId markerId) async { if (Platform.isAndroid) { return googleController! .isMarkerInfoWindowShown(markerId.googleMapsMarkerId); } else if (Platform.isIOS) { - return appleController! - .isMarkerInfoWindowShown(markerId.appleMapsAnnoationId); + return await appleController! + .isMarkerInfoWindowShown(markerId.appleMapsAnnoationId) ?? + false; } throw ('Platform not supported.'); } diff --git a/pubspec.yaml b/pubspec.yaml index e9e37d2..b6d295e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: sdk: flutter google_maps_flutter: ^2.0.1 + google_maps_flutter_platform_interface: ^2.0.3 apple_maps_flutter: ^1.0.0 dev_dependencies: