Skip to content

Commit d1148c6

Browse files
renefloormvolpato
andcommitted
refactor: update if statements to switch statement
Co-authored-by: Michele Volpato <[email protected]> Signed-off-by: Rene Floor <[email protected]>
1 parent 37f3475 commit d1148c6

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

packages/platform_maps_flutter_apple/lib/src/apple_maps_widget.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ class _PlatformMapState extends State<_PlatformMap> {
205205
}
206206

207207
apple_maps.MapType _getMapType() {
208-
if (widget.mapType == MapType.normal) {
209-
return apple_maps.MapType.standard;
210-
} else if (widget.mapType == MapType.satellite) {
211-
return apple_maps.MapType.satellite;
212-
} else if (widget.mapType == MapType.hybrid) {
213-
return apple_maps.MapType.hybrid;
208+
switch (widget.mapType) {
209+
case MapType.normal:
210+
return apple_maps.MapType.standard;
211+
case MapType.satellite:
212+
return apple_maps.MapType.satellite;
213+
case MapType.hybrid:
214+
return apple_maps.MapType.hybrid;
214215
}
215-
return apple_maps.MapType.standard;
216216
}
217217
}

packages/platform_maps_flutter_google_android/lib/src/google_maps_widget.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ class _PlatformMapState extends State<_PlatformMap> {
210210
}
211211

212212
google_maps.MapType _getGoogleMapType() {
213-
if (widget.mapType == MapType.normal) {
214-
return google_maps.MapType.normal;
215-
} else if (widget.mapType == MapType.satellite) {
216-
return google_maps.MapType.satellite;
217-
} else if (widget.mapType == MapType.hybrid) {
218-
return google_maps.MapType.hybrid;
213+
switch (widget.mapType) {
214+
case MapType.normal:
215+
return google_maps.MapType.normal;
216+
case MapType.satellite:
217+
return google_maps.MapType.satellite;
218+
case MapType.hybrid:
219+
return google_maps.MapType.hybrid;
219220
}
220-
return google_maps.MapType.normal;
221221
}
222222
}

0 commit comments

Comments
 (0)