1
1
part of platform_maps_flutter;
2
2
3
3
class PlatformMapController {
4
- late appleMaps.AppleMapController appleController;
5
- late googleMaps.GoogleMapController googleController;
4
+ appleMaps.AppleMapController ? appleController;
5
+ googleMaps.GoogleMapController ? googleController;
6
6
7
7
PlatformMapController (dynamic controller) {
8
8
if (controller.runtimeType == googleMaps.GoogleMapController ) {
@@ -22,9 +22,9 @@ class PlatformMapController {
22
22
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
23
23
Future <void > showMarkerInfoWindow (MarkerId markerId) {
24
24
if (Platform .isAndroid) {
25
- return googleController.showMarkerInfoWindow (markerId.googleMapsMarkerId);
25
+ return googleController! .showMarkerInfoWindow (markerId.googleMapsMarkerId);
26
26
} else if (Platform .isIOS) {
27
- return appleController
27
+ return appleController!
28
28
.showMarkerInfoWindow (markerId.appleMapsAnnoationId);
29
29
}
30
30
throw ('Platform not supported.' );
@@ -40,9 +40,9 @@ class PlatformMapController {
40
40
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
41
41
Future <void > hideMarkerInfoWindow (MarkerId markerId) {
42
42
if (Platform .isAndroid) {
43
- return googleController.hideMarkerInfoWindow (markerId.googleMapsMarkerId);
43
+ return googleController! .hideMarkerInfoWindow (markerId.googleMapsMarkerId);
44
44
} else if (Platform .isIOS) {
45
- return appleController
45
+ return appleController!
46
46
.hideMarkerInfoWindow (markerId.appleMapsAnnoationId);
47
47
}
48
48
throw ('Platform not supported.' );
@@ -58,10 +58,10 @@ class PlatformMapController {
58
58
/// * [hideMarkerInfoWindow] to hide the Info Window.
59
59
Future <bool > isMarkerInfoWindowShown (MarkerId markerId) {
60
60
if (Platform .isAndroid) {
61
- return googleController
61
+ return googleController!
62
62
.isMarkerInfoWindowShown (markerId.googleMapsMarkerId);
63
63
} else if (Platform .isIOS) {
64
- return appleController
64
+ return appleController!
65
65
.isMarkerInfoWindowShown (markerId.appleMapsAnnoationId);
66
66
}
67
67
throw ('Platform not supported.' );
@@ -73,9 +73,9 @@ class PlatformMapController {
73
73
/// platform side.
74
74
Future <void > animateCamera (cameraUpdate) async {
75
75
if (Platform .isIOS) {
76
- return this .appleController.animateCamera (cameraUpdate);
76
+ return this .appleController! .animateCamera (cameraUpdate);
77
77
} else if (Platform .isAndroid) {
78
- return this .googleController.animateCamera (cameraUpdate);
78
+ return this .googleController! .animateCamera (cameraUpdate);
79
79
}
80
80
throw ('Platform not supported.' );
81
81
}
@@ -86,9 +86,9 @@ class PlatformMapController {
86
86
/// platform side.
87
87
Future <void > moveCamera (cameraUpdate) async {
88
88
if (Platform .isIOS) {
89
- return this .appleController.moveCamera (cameraUpdate);
89
+ return this .appleController! .moveCamera (cameraUpdate);
90
90
} else if (Platform .isAndroid) {
91
- return this .googleController.moveCamera (cameraUpdate);
91
+ return this .googleController! .moveCamera (cameraUpdate);
92
92
}
93
93
}
94
94
@@ -97,11 +97,11 @@ class PlatformMapController {
97
97
late LatLngBounds _bounds;
98
98
if (Platform .isIOS) {
99
99
appleMaps.LatLngBounds appleBounds =
100
- await this .appleController.getVisibleRegion ();
100
+ await this .appleController! .getVisibleRegion ();
101
101
_bounds = LatLngBounds ._fromAppleLatLngBounds (appleBounds);
102
102
} else if (Platform .isAndroid) {
103
103
googleMaps.LatLngBounds googleBounds =
104
- await this .googleController.getVisibleRegion ();
104
+ await this .googleController! .getVisibleRegion ();
105
105
_bounds = LatLngBounds ._fromGoogleLatLngBounds (googleBounds);
106
106
}
107
107
return _bounds;
0 commit comments