Skip to content

Commit

Permalink
fix: Build failure after Nullability update
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisThein committed Mar 28, 2021
1 parent 2112aea commit b96fe62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
17 changes: 10 additions & 7 deletions lib/src/controller.dart
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -22,7 +22,8 @@ class PlatformMapController {
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
Future<void> 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);
Expand All @@ -40,7 +41,8 @@ class PlatformMapController {
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
Future<void> 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);
Expand All @@ -56,13 +58,14 @@ class PlatformMapController {
/// * See also:
/// * [showMarkerInfoWindow] to show the Info Window.
/// * [hideMarkerInfoWindow] to hide the Info Window.
Future<bool> isMarkerInfoWindowShown(MarkerId markerId) {
Future<bool> 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.');
}
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b96fe62

Please sign in to comment.