Skip to content

Commit 02b7aa8

Browse files
committed
Set controllers as nullable instead of late declarations.
1 parent 5e650f5 commit 02b7aa8

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/src/controller.dart

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
part of platform_maps_flutter;
22

33
class PlatformMapController {
4-
late appleMaps.AppleMapController appleController;
5-
late googleMaps.GoogleMapController googleController;
4+
appleMaps.AppleMapController? appleController;
5+
googleMaps.GoogleMapController? googleController;
66

77
PlatformMapController(dynamic controller) {
88
if (controller.runtimeType == googleMaps.GoogleMapController) {
@@ -22,9 +22,9 @@ class PlatformMapController {
2222
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
2323
Future<void> showMarkerInfoWindow(MarkerId markerId) {
2424
if (Platform.isAndroid) {
25-
return googleController.showMarkerInfoWindow(markerId.googleMapsMarkerId);
25+
return googleController!.showMarkerInfoWindow(markerId.googleMapsMarkerId);
2626
} else if (Platform.isIOS) {
27-
return appleController
27+
return appleController!
2828
.showMarkerInfoWindow(markerId.appleMapsAnnoationId);
2929
}
3030
throw ('Platform not supported.');
@@ -40,9 +40,9 @@ class PlatformMapController {
4040
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
4141
Future<void> hideMarkerInfoWindow(MarkerId markerId) {
4242
if (Platform.isAndroid) {
43-
return googleController.hideMarkerInfoWindow(markerId.googleMapsMarkerId);
43+
return googleController!.hideMarkerInfoWindow(markerId.googleMapsMarkerId);
4444
} else if (Platform.isIOS) {
45-
return appleController
45+
return appleController!
4646
.hideMarkerInfoWindow(markerId.appleMapsAnnoationId);
4747
}
4848
throw ('Platform not supported.');
@@ -58,10 +58,10 @@ class PlatformMapController {
5858
/// * [hideMarkerInfoWindow] to hide the Info Window.
5959
Future<bool> isMarkerInfoWindowShown(MarkerId markerId) {
6060
if (Platform.isAndroid) {
61-
return googleController
61+
return googleController!
6262
.isMarkerInfoWindowShown(markerId.googleMapsMarkerId);
6363
} else if (Platform.isIOS) {
64-
return appleController
64+
return appleController!
6565
.isMarkerInfoWindowShown(markerId.appleMapsAnnoationId);
6666
}
6767
throw ('Platform not supported.');
@@ -73,9 +73,9 @@ class PlatformMapController {
7373
/// platform side.
7474
Future<void> animateCamera(cameraUpdate) async {
7575
if (Platform.isIOS) {
76-
return this.appleController.animateCamera(cameraUpdate);
76+
return this.appleController!.animateCamera(cameraUpdate);
7777
} else if (Platform.isAndroid) {
78-
return this.googleController.animateCamera(cameraUpdate);
78+
return this.googleController!.animateCamera(cameraUpdate);
7979
}
8080
throw ('Platform not supported.');
8181
}
@@ -86,9 +86,9 @@ class PlatformMapController {
8686
/// platform side.
8787
Future<void> moveCamera(cameraUpdate) async {
8888
if (Platform.isIOS) {
89-
return this.appleController.moveCamera(cameraUpdate);
89+
return this.appleController!.moveCamera(cameraUpdate);
9090
} else if (Platform.isAndroid) {
91-
return this.googleController.moveCamera(cameraUpdate);
91+
return this.googleController!.moveCamera(cameraUpdate);
9292
}
9393
}
9494

@@ -97,11 +97,11 @@ class PlatformMapController {
9797
late LatLngBounds _bounds;
9898
if (Platform.isIOS) {
9999
appleMaps.LatLngBounds appleBounds =
100-
await this.appleController.getVisibleRegion();
100+
await this.appleController!.getVisibleRegion();
101101
_bounds = LatLngBounds._fromAppleLatLngBounds(appleBounds);
102102
} else if (Platform.isAndroid) {
103103
googleMaps.LatLngBounds googleBounds =
104-
await this.googleController.getVisibleRegion();
104+
await this.googleController!.getVisibleRegion();
105105
_bounds = LatLngBounds._fromGoogleLatLngBounds(googleBounds);
106106
}
107107
return _bounds;

0 commit comments

Comments
 (0)