Skip to content

Commit 5f09d0e

Browse files
committed
chore: format code
1 parent 17fb1fa commit 5f09d0e

File tree

15 files changed

+337
-353
lines changed

15 files changed

+337
-353
lines changed

android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsBaseMapView.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,7 @@ abstract class GoogleMapsBaseMapView(
543543
// library for geolocation or implement separate method under
544544
// [GoogleMapsNavigationSessionManager] to fetch the location
545545
// using the [FusedLocationProviderApi].
546-
@Suppress("DEPRECATION")
547-
val location = getMap().myLocation
546+
@Suppress("DEPRECATION") val location = getMap().myLocation
548547
// Return null explicitly if location is not available to avoid NullPointerException
549548
// when the platform channel tries to serialize the Location object
550549
return if (location != null && location.provider != null) location else null

lib/src/method_channel/auto_view_api.dart

Lines changed: 81 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -310,21 +310,19 @@ class AutoMapViewAPIImpl {
310310
duration,
311311
)
312312
.then(
313-
(bool success) =>
314-
onFinished != null && Platform.isAndroid
315-
? onFinished(success)
316-
: null,
313+
(bool success) => onFinished != null && Platform.isAndroid
314+
? onFinished(success)
315+
: null,
317316
),
318317
);
319318
case CameraUpdateType.latLng:
320319
unawaited(
321320
_viewApi
322321
.animateCameraToLatLng(cameraUpdate.latLng!.toDto(), duration)
323322
.then(
324-
(bool success) =>
325-
onFinished != null && Platform.isAndroid
326-
? onFinished(success)
327-
: null,
323+
(bool success) => onFinished != null && Platform.isAndroid
324+
? onFinished(success)
325+
: null,
328326
),
329327
);
330328
case CameraUpdateType.latLngBounds:
@@ -336,10 +334,9 @@ class AutoMapViewAPIImpl {
336334
duration,
337335
)
338336
.then(
339-
(bool success) =>
340-
onFinished != null && Platform.isAndroid
341-
? onFinished(success)
342-
: null,
337+
(bool success) => onFinished != null && Platform.isAndroid
338+
? onFinished(success)
339+
: null,
343340
),
344341
);
345342
case CameraUpdateType.latLngZoom:
@@ -351,10 +348,9 @@ class AutoMapViewAPIImpl {
351348
duration,
352349
)
353350
.then(
354-
(bool success) =>
355-
onFinished != null && Platform.isAndroid
356-
? onFinished(success)
357-
: null,
351+
(bool success) => onFinished != null && Platform.isAndroid
352+
? onFinished(success)
353+
: null,
358354
),
359355
);
360356
case CameraUpdateType.scrollBy:
@@ -366,10 +362,9 @@ class AutoMapViewAPIImpl {
366362
duration,
367363
)
368364
.then(
369-
(bool success) =>
370-
onFinished != null && Platform.isAndroid
371-
? onFinished(success)
372-
: null,
365+
(bool success) => onFinished != null && Platform.isAndroid
366+
? onFinished(success)
367+
: null,
373368
),
374369
);
375370
case CameraUpdateType.zoomBy:
@@ -382,21 +377,19 @@ class AutoMapViewAPIImpl {
382377
duration,
383378
)
384379
.then(
385-
(bool success) =>
386-
onFinished != null && Platform.isAndroid
387-
? onFinished(success)
388-
: null,
380+
(bool success) => onFinished != null && Platform.isAndroid
381+
? onFinished(success)
382+
: null,
389383
),
390384
);
391385
case CameraUpdateType.zoomTo:
392386
unawaited(
393387
_viewApi
394388
.animateCameraToZoom(cameraUpdate.zoom!, duration)
395389
.then(
396-
(bool success) =>
397-
onFinished != null && Platform.isAndroid
398-
? onFinished(success)
399-
: null,
390+
(bool success) => onFinished != null && Platform.isAndroid
391+
? onFinished(success)
392+
: null,
400393
),
401394
);
402395
}
@@ -494,17 +487,17 @@ class AutoMapViewAPIImpl {
494487
required List<MarkerOptions> markerOptions,
495488
}) async {
496489
// Convert options to pigeon format
497-
final List<MarkerOptionsDto> options =
498-
markerOptions.map((MarkerOptions opt) => opt.toDto()).toList();
490+
final List<MarkerOptionsDto> options = markerOptions
491+
.map((MarkerOptions opt) => opt.toDto())
492+
.toList();
499493

500494
// Create marker objects with new ID's
501-
final List<MarkerDto> markersToAdd =
502-
options
503-
.map(
504-
(MarkerOptionsDto options) =>
505-
MarkerDto(markerId: _createMarkerId(), options: options),
506-
)
507-
.toList();
495+
final List<MarkerDto> markersToAdd = options
496+
.map(
497+
(MarkerOptionsDto options) =>
498+
MarkerDto(markerId: _createMarkerId(), options: options),
499+
)
500+
.toList();
508501

509502
// Add markers to map
510503
final List<MarkerDto?> markersAdded = await _viewApi.addMarkers(
@@ -524,8 +517,9 @@ class AutoMapViewAPIImpl {
524517
/// Update markers on the map view.
525518
Future<List<Marker>> updateMarkers({required List<Marker> markers}) async {
526519
try {
527-
final List<MarkerDto> markerDtos =
528-
markers.map((Marker marker) => marker.toDto()).toList();
520+
final List<MarkerDto> markerDtos = markers
521+
.map((Marker marker) => marker.toDto())
522+
.toList();
529523
final List<MarkerDto?> updatedMarkers = await _viewApi.updateMarkers(
530524
markerDtos,
531525
);
@@ -545,8 +539,9 @@ class AutoMapViewAPIImpl {
545539
/// Remove markers from map view.
546540
Future<void> removeMarkers({required List<Marker> markers}) async {
547541
try {
548-
final List<MarkerDto> markerDtos =
549-
markers.map((Marker marker) => marker.toDto()).toList();
542+
final List<MarkerDto> markerDtos = markers
543+
.map((Marker marker) => marker.toDto())
544+
.toList();
550545
return await _viewApi.removeMarkers(markerDtos);
551546
} on PlatformException catch (error) {
552547
if (error.code == 'markerNotFound') {
@@ -582,17 +577,17 @@ class AutoMapViewAPIImpl {
582577
required List<PolygonOptions> polygonOptions,
583578
}) async {
584579
// Convert options to pigeon format
585-
final List<PolygonOptionsDto> options =
586-
polygonOptions.map((PolygonOptions opt) => opt.toDto()).toList();
580+
final List<PolygonOptionsDto> options = polygonOptions
581+
.map((PolygonOptions opt) => opt.toDto())
582+
.toList();
587583

588584
// Create polygon objects with new ID's
589-
final List<PolygonDto> polygonsToAdd =
590-
options
591-
.map(
592-
(PolygonOptionsDto options) =>
593-
PolygonDto(polygonId: _createPolygonId(), options: options),
594-
)
595-
.toList();
585+
final List<PolygonDto> polygonsToAdd = options
586+
.map(
587+
(PolygonOptionsDto options) =>
588+
PolygonDto(polygonId: _createPolygonId(), options: options),
589+
)
590+
.toList();
596591

597592
// Add polygons to map
598593
final List<PolygonDto?> polygonsAdded = await _viewApi.addPolygons(
@@ -614,8 +609,9 @@ class AutoMapViewAPIImpl {
614609
required List<Polygon> polygons,
615610
}) async {
616611
try {
617-
final List<PolygonDto> navigationViewPolygons =
618-
polygons.map((Polygon polygon) => polygon.toDto()).toList();
612+
final List<PolygonDto> navigationViewPolygons = polygons
613+
.map((Polygon polygon) => polygon.toDto())
614+
.toList();
619615
final List<PolygonDto?> updatedPolygons = await _viewApi.updatePolygons(
620616
navigationViewPolygons,
621617
);
@@ -635,8 +631,9 @@ class AutoMapViewAPIImpl {
635631
/// Remove polygons from map view.
636632
Future<void> removePolygons({required List<Polygon> polygons}) async {
637633
try {
638-
final List<PolygonDto> navigationViewPolygons =
639-
polygons.map((Polygon polygon) => polygon.toDto()).toList();
634+
final List<PolygonDto> navigationViewPolygons = polygons
635+
.map((Polygon polygon) => polygon.toDto())
636+
.toList();
640637
return await _viewApi.removePolygons(navigationViewPolygons);
641638
} on PlatformException catch (error) {
642639
if (error.code == 'polygonNotFound') {
@@ -667,19 +664,17 @@ class AutoMapViewAPIImpl {
667664
required List<PolylineOptions> polylineOptions,
668665
}) async {
669666
// Convert options to pigeon format
670-
final List<PolylineOptionsDto> options =
671-
polylineOptions.map((PolylineOptions opt) => opt.toDto()).toList();
667+
final List<PolylineOptionsDto> options = polylineOptions
668+
.map((PolylineOptions opt) => opt.toDto())
669+
.toList();
672670

673671
// Create polyline objects with new ID's
674-
final List<PolylineDto> polylinesToAdd =
675-
options
676-
.map(
677-
(PolylineOptionsDto options) => PolylineDto(
678-
polylineId: _createPolylineId(),
679-
options: options,
680-
),
681-
)
682-
.toList();
672+
final List<PolylineDto> polylinesToAdd = options
673+
.map(
674+
(PolylineOptionsDto options) =>
675+
PolylineDto(polylineId: _createPolylineId(), options: options),
676+
)
677+
.toList();
683678

684679
// Add polylines to map
685680
final List<PolylineDto?> polylinesAdded = await _viewApi.addPolylines(
@@ -701,10 +696,9 @@ class AutoMapViewAPIImpl {
701696
required List<Polyline> polylines,
702697
}) async {
703698
try {
704-
final List<PolylineDto> navigationViewPolylines =
705-
polylines
706-
.map((Polyline polyline) => polyline.toNavigationViewPolyline())
707-
.toList();
699+
final List<PolylineDto> navigationViewPolylines = polylines
700+
.map((Polyline polyline) => polyline.toNavigationViewPolyline())
701+
.toList();
708702
final List<PolylineDto?> updatedPolylines = await _viewApi
709703
.updatePolylines(navigationViewPolylines);
710704
return updatedPolylines
@@ -723,10 +717,9 @@ class AutoMapViewAPIImpl {
723717
/// Remove polylines from map view.
724718
Future<void> removePolylines({required List<Polyline> polylines}) async {
725719
try {
726-
final List<PolylineDto> navigationViewPolylines =
727-
polylines
728-
.map((Polyline polyline) => polyline.toNavigationViewPolyline())
729-
.toList();
720+
final List<PolylineDto> navigationViewPolylines = polylines
721+
.map((Polyline polyline) => polyline.toNavigationViewPolyline())
722+
.toList();
730723
return await _viewApi.removePolylines(navigationViewPolylines);
731724
} on PlatformException catch (error) {
732725
if (error.code == 'polylineNotFound') {
@@ -757,17 +750,17 @@ class AutoMapViewAPIImpl {
757750
required List<CircleOptions> options,
758751
}) async {
759752
// Convert options to pigeon format
760-
final List<CircleOptionsDto> optionsDto =
761-
options.map((CircleOptions opt) => opt.toDto()).toList();
753+
final List<CircleOptionsDto> optionsDto = options
754+
.map((CircleOptions opt) => opt.toDto())
755+
.toList();
762756

763757
// Create circle objects with new ID's
764-
final List<CircleDto> circlesToAdd =
765-
optionsDto
766-
.map(
767-
(CircleOptionsDto options) =>
768-
CircleDto(circleId: _createCircleId(), options: options),
769-
)
770-
.toList();
758+
final List<CircleDto> circlesToAdd = optionsDto
759+
.map(
760+
(CircleOptionsDto options) =>
761+
CircleDto(circleId: _createCircleId(), options: options),
762+
)
763+
.toList();
771764

772765
// Add circles to map
773766
final List<CircleDto?> circlesAdded = await _viewApi.addCircles(
@@ -787,8 +780,9 @@ class AutoMapViewAPIImpl {
787780
/// Update circles on the map view.
788781
Future<List<Circle?>> updateCircles({required List<Circle> circles}) async {
789782
try {
790-
final List<CircleDto> navigationViewCircles =
791-
circles.map((Circle circle) => circle.toDto()).toList();
783+
final List<CircleDto> navigationViewCircles = circles
784+
.map((Circle circle) => circle.toDto())
785+
.toList();
792786
final List<CircleDto?> updatedCircles = await _viewApi.updateCircles(
793787
navigationViewCircles,
794788
);
@@ -809,8 +803,9 @@ class AutoMapViewAPIImpl {
809803
/// Remove circles from map view.
810804
Future<void> removeCircles({required List<Circle> circles}) async {
811805
try {
812-
final List<CircleDto> navigationViewCircles =
813-
circles.map((Circle circle) => circle.toDto()).toList();
806+
final List<CircleDto> navigationViewCircles = circles
807+
.map((Circle circle) => circle.toDto())
808+
.toList();
814809
return await _viewApi.removeCircles(navigationViewCircles);
815810
} on PlatformException catch (error) {
816811
if (error.code == 'circleNotFound') {

lib/src/method_channel/convert/circle.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ extension ConvertCircleOptionsDto on CircleOptionsDto {
4747
fillColor: Color(fillColor),
4848
strokeColor: Color(strokeColor),
4949
strokeWidth: strokeWidth,
50-
strokePattern:
51-
strokePattern
52-
.map((PatternItemDto? e) => e?.toPatternItem())
53-
.whereType<PatternItem>()
54-
.toList(),
50+
strokePattern: strokePattern
51+
.map((PatternItemDto? e) => e?.toPatternItem())
52+
.whereType<PatternItem>()
53+
.toList(),
5554
visible: visible,
5655
zIndex: zIndex,
5756
);

lib/src/method_channel/convert/destinations.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ import 'navigation_waypoint.dart';
2222
extension ConvertDestinations on Destinations {
2323
/// Converts [Destinations] to [DestinationsDto]
2424
DestinationsDto toDto() => DestinationsDto(
25-
waypoints:
26-
waypoints.map((NavigationWaypoint e) {
27-
return e.toDto();
28-
}).toList(),
25+
waypoints: waypoints.map((NavigationWaypoint e) {
26+
return e.toDto();
27+
}).toList(),
2928
displayOptions: displayOptions.toDto(),
3029
routingOptions: routingOptions?.toDto(),
3130
routeTokenOptions: routeTokenOptions?.toDto(),

0 commit comments

Comments
 (0)