[google_maps_flutter] Switch app-facing package to new analysis options (#4716)
diff --git a/packages/google_maps_flutter/google_maps_flutter/AUTHORS b/packages/google_maps_flutter/google_maps_flutter/AUTHORS
index 493a0b4..9f1b53e 100644
--- a/packages/google_maps_flutter/google_maps_flutter/AUTHORS
+++ b/packages/google_maps_flutter/google_maps_flutter/AUTHORS
@@ -64,3 +64,4 @@
Anton Borries <mail@antonborri.es>
Alex Li <google@alexv525.com>
Rahul Raj <64.rahulraj@gmail.com>
+Taha Tesser <tesser@gmail.com>
diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
index b9178a7..565bf84 100644
--- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
+++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
@@ -1,7 +1,8 @@
-## NEXT
+## 2.1.2
* Removes dependencies from `pubspec.yaml` that are only needed in `example/pubspec.yaml`
* Updates Android compileSdkVersion to 31.
+* Internal code cleanup for stricter analysis options.
## 2.1.1
diff --git a/packages/google_maps_flutter/google_maps_flutter/analysis_options.yaml b/packages/google_maps_flutter/google_maps_flutter/analysis_options.yaml
deleted file mode 100644
index 5aeb4e7..0000000
--- a/packages/google_maps_flutter/google_maps_flutter/analysis_options.yaml
+++ /dev/null
@@ -1 +0,0 @@
-include: ../../../analysis_options_legacy.yaml
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_map_inspector.dart b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_map_inspector.dart
index a4833fe..34baa90 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_map_inspector.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_map_inspector.dart
@@ -78,9 +78,9 @@
}
Future<Map<String, dynamic>?> getTileOverlayInfo(String id) async {
- return (await _channel.invokeMapMethod<String, dynamic>(
+ return await _channel.invokeMapMethod<String, dynamic>(
'map#getTileOverlayInfo', <String, String>{
'tileOverlayId': id,
- }));
+ });
}
}
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_maps_test.dart
index 8bafca1..a007ddd 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_maps_test.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_maps_test.dart
@@ -7,11 +7,11 @@
import 'dart:typed_data';
import 'dart:ui' as ui;
-import 'package:integration_test/integration_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
+import 'package:integration_test/integration_test.dart';
import 'google_map_inspector.dart';
@@ -53,7 +53,7 @@
initialCameraPosition: _kInitialCameraPosition,
compassEnabled: true,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -93,7 +93,7 @@
initialCameraPosition: _kInitialCameraPosition,
mapToolbarEnabled: true,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -140,7 +140,8 @@
final GoogleMapInspector inspector = await inspectorCompleter.future;
if (Platform.isIOS) {
- MinMaxZoomPreference zoomLevel = await inspector.getMinMaxZoomLevels();
+ final MinMaxZoomPreference zoomLevel =
+ await inspector.getMinMaxZoomLevels();
expect(zoomLevel, equals(initialZoomLevel));
} else if (Platform.isAndroid) {
await controller.moveCamera(CameraUpdate.zoomTo(15));
@@ -161,13 +162,14 @@
initialCameraPosition: _kInitialCameraPosition,
minMaxZoomPreference: finalZoomLevel,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
if (Platform.isIOS) {
- MinMaxZoomPreference zoomLevel = await inspector.getMinMaxZoomLevels();
+ final MinMaxZoomPreference zoomLevel =
+ await inspector.getMinMaxZoomLevels();
expect(zoomLevel, equals(finalZoomLevel));
} else {
await controller.moveCamera(CameraUpdate.zoomTo(15));
@@ -213,7 +215,7 @@
initialCameraPosition: _kInitialCameraPosition,
zoomGesturesEnabled: true,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -243,7 +245,7 @@
final GoogleMapInspector inspector = await inspectorCompleter.future;
bool? zoomControlsEnabled = await inspector.isZoomControlsEnabled();
- expect(zoomControlsEnabled, Platform.isIOS ? false : true);
+ expect(zoomControlsEnabled, !Platform.isIOS);
/// Zoom Controls functionality is not available on iOS at the moment.
if (Platform.isAndroid) {
@@ -254,7 +256,7 @@
initialCameraPosition: _kInitialCameraPosition,
zoomControlsEnabled: false,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -295,7 +297,7 @@
initialCameraPosition: _kInitialCameraPosition,
liteModeEnabled: true,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -335,7 +337,7 @@
initialCameraPosition: _kInitialCameraPosition,
rotateGesturesEnabled: true,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -375,7 +377,7 @@
initialCameraPosition: _kInitialCameraPosition,
tiltGesturesEnabled: true,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -415,7 +417,7 @@
initialCameraPosition: _kInitialCameraPosition,
scrollGesturesEnabled: true,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -449,11 +451,11 @@
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
- await Future.delayed(Duration(seconds: 1));
+ await Future<void>.delayed(const Duration(seconds: 1));
- ScreenCoordinate coordinate =
+ final ScreenCoordinate coordinate =
await mapController.getScreenCoordinate(_kInitialCameraPosition.target);
- Rect rect = tester.getRect(find.byKey(key));
+ final Rect rect = tester.getRect(find.byKey(key));
if (Platform.isIOS) {
// On iOS, the coordinate value from the GoogleMapSdk doesn't include the devicePixelRatio`.
// So we don't need to do the conversion like we did below for other platforms.
@@ -525,7 +527,7 @@
// TODO(iskakaushik): non-zero padding is needed for some device configurations
// https://github.com/flutter/flutter/issues/30575
- final double padding = 0;
+ const double padding = 0;
await mapController
.moveCamera(CameraUpdate.newLatLngBounds(latLngBounds, padding));
await tester.pumpAndSettle(const Duration(seconds: 3));
@@ -573,7 +575,7 @@
initialCameraPosition: _kInitialCameraPosition,
trafficEnabled: false,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -641,7 +643,7 @@
myLocationButtonEnabled: false,
myLocationEnabled: false,
onMapCreated: (GoogleMapController controller) {
- fail("OnMapCreated should get called only once.");
+ fail('OnMapCreated should get called only once.');
},
),
));
@@ -723,7 +725,7 @@
));
final GoogleMapController controller = await controllerCompleter.future;
- final String mapStyle =
+ const String mapStyle =
'[{"elementType":"geometry","stylers":[{"color":"#242f3e"}]}]';
await controller.setMapStyle(mapStyle);
});
@@ -797,7 +799,7 @@
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
- await Future.delayed(Duration(seconds: 1));
+ await Future<void>.delayed(const Duration(seconds: 1));
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
final LatLng topLeft =
@@ -832,7 +834,7 @@
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
- await Future.delayed(Duration(seconds: 1));
+ await Future<void>.delayed(const Duration(seconds: 1));
double zoom = await controller.getZoomLevel();
expect(zoom, _kInitialZoomLevel);
@@ -864,7 +866,7 @@
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
- await Future.delayed(Duration(seconds: 1));
+ await Future<void>.delayed(const Duration(seconds: 1));
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
final LatLng northWest = LatLng(
@@ -902,7 +904,7 @@
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
- await Future.delayed(Duration(seconds: 1));
+ await Future<void>.delayed(const Duration(seconds: 1));
// Simple call to make sure that the app hasn't crashed.
final LatLngBounds bounds1 = await controller.getVisibleRegion();
@@ -911,12 +913,12 @@
});
testWidgets('testToggleInfoWindow', (WidgetTester tester) async {
- final Marker marker = Marker(
- markerId: MarkerId("marker"),
- infoWindow: InfoWindow(title: "InfoWindow"));
+ const Marker marker = Marker(
+ markerId: MarkerId('marker'),
+ infoWindow: InfoWindow(title: 'InfoWindow'));
final Set<Marker> markers = <Marker>{marker};
- Completer<GoogleMapController> controllerCompleter =
+ final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();
await tester.pumpWidget(Directionality(
@@ -930,7 +932,7 @@
),
));
- GoogleMapController controller = await controllerCompleter.future;
+ final GoogleMapController controller = await controllerCompleter.future;
bool iwVisibleStatus =
await controller.isMarkerInfoWindowShown(marker.markerId);
@@ -945,9 +947,9 @@
expect(iwVisibleStatus, false);
});
- testWidgets("fromAssetImage", (WidgetTester tester) async {
- double pixelRatio = 2;
- final ImageConfiguration imageConfiguration =
+ testWidgets('fromAssetImage', (WidgetTester tester) async {
+ const double pixelRatio = 2;
+ const ImageConfiguration imageConfiguration =
ImageConfiguration(devicePixelRatio: pixelRatio);
final BitmapDescriptor mip = await BitmapDescriptor.fromAssetImage(
imageConfiguration, 'red_square.png');
@@ -959,7 +961,7 @@
});
testWidgets('testTakeSnapshot', (WidgetTester tester) async {
- Completer<GoogleMapInspector> inspectorCompleter =
+ final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
await tester.pumpWidget(
@@ -990,10 +992,10 @@
testWidgets(
'set tileOverlay correctly',
(WidgetTester tester) async {
- Completer<GoogleMapInspector> inspectorCompleter =
+ final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
final TileOverlay tileOverlay1 = TileOverlay(
- tileOverlayId: TileOverlayId('tile_overlay_1'),
+ tileOverlayId: const TileOverlayId('tile_overlay_1'),
tileProvider: _DebugTileProvider(),
zIndex: 2,
visible: true,
@@ -1002,7 +1004,7 @@
);
final TileOverlay tileOverlay2 = TileOverlay(
- tileOverlayId: TileOverlayId('tile_overlay_2'),
+ tileOverlayId: const TileOverlayId('tile_overlay_2'),
tileProvider: _DebugTileProvider(),
zIndex: 1,
visible: false,
@@ -1028,9 +1030,9 @@
final GoogleMapInspector inspector = await inspectorCompleter.future;
- Map<String, dynamic> tileOverlayInfo1 =
+ final Map<String, dynamic> tileOverlayInfo1 =
(await inspector.getTileOverlayInfo('tile_overlay_1'))!;
- Map<String, dynamic> tileOverlayInfo2 =
+ final Map<String, dynamic> tileOverlayInfo2 =
(await inspector.getTileOverlayInfo('tile_overlay_2'))!;
expect(tileOverlayInfo1['visible'], isTrue);
@@ -1050,11 +1052,11 @@
testWidgets(
'update tileOverlays correctly',
(WidgetTester tester) async {
- Completer<GoogleMapInspector> inspectorCompleter =
+ final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
final Key key = GlobalKey();
final TileOverlay tileOverlay1 = TileOverlay(
- tileOverlayId: TileOverlayId('tile_overlay_1'),
+ tileOverlayId: const TileOverlayId('tile_overlay_1'),
tileProvider: _DebugTileProvider(),
zIndex: 2,
visible: true,
@@ -1063,7 +1065,7 @@
);
final TileOverlay tileOverlay2 = TileOverlay(
- tileOverlayId: TileOverlayId('tile_overlay_2'),
+ tileOverlayId: const TileOverlayId('tile_overlay_2'),
tileProvider: _DebugTileProvider(),
zIndex: 3,
visible: true,
@@ -1090,7 +1092,7 @@
final GoogleMapInspector inspector = await inspectorCompleter.future;
final TileOverlay tileOverlay1New = TileOverlay(
- tileOverlayId: TileOverlayId('tile_overlay_1'),
+ tileOverlayId: const TileOverlayId('tile_overlay_1'),
tileProvider: _DebugTileProvider(),
zIndex: 1,
visible: false,
@@ -1114,9 +1116,9 @@
await tester.pumpAndSettle(const Duration(seconds: 3));
- Map<String, dynamic> tileOverlayInfo1 =
+ final Map<String, dynamic> tileOverlayInfo1 =
(await inspector.getTileOverlayInfo('tile_overlay_1'))!;
- Map<String, dynamic>? tileOverlayInfo2 =
+ final Map<String, dynamic>? tileOverlayInfo2 =
await inspector.getTileOverlayInfo('tile_overlay_2');
expect(tileOverlayInfo1['visible'], isFalse);
@@ -1132,11 +1134,11 @@
testWidgets(
'remove tileOverlays correctly',
(WidgetTester tester) async {
- Completer<GoogleMapInspector> inspectorCompleter =
+ final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
final Key key = GlobalKey();
final TileOverlay tileOverlay1 = TileOverlay(
- tileOverlayId: TileOverlayId('tile_overlay_1'),
+ tileOverlayId: const TileOverlayId('tile_overlay_1'),
tileProvider: _DebugTileProvider(),
zIndex: 2,
visible: true,
@@ -1177,7 +1179,7 @@
);
await tester.pumpAndSettle(const Duration(seconds: 3));
- Map<String, dynamic>? tileOverlayInfo1 =
+ final Map<String, dynamic>? tileOverlayInfo1 =
await inspector.getTileOverlayInfo('tile_overlay_1');
expect(tileOverlayInfo1, isNull);
@@ -1196,7 +1198,7 @@
static const int width = 100;
static const int height = 100;
static final Paint boxPaint = Paint();
- static final TextStyle textStyle = TextStyle(
+ static const TextStyle textStyle = TextStyle(
color: Colors.red,
fontSize: 20,
);
@@ -1206,7 +1208,7 @@
final ui.PictureRecorder recorder = ui.PictureRecorder();
final Canvas canvas = Canvas(recorder);
final TextSpan textSpan = TextSpan(
- text: "$x,$y",
+ text: '$x,$y',
style: textStyle,
);
final TextPainter textPainter = TextPainter(
@@ -1217,7 +1219,7 @@
minWidth: 0.0,
maxWidth: width.toDouble(),
);
- final Offset offset = const Offset(0, 0);
+ const Offset offset = Offset(0, 0);
textPainter.paint(canvas, offset);
canvas.drawRect(
Rect.fromLTRB(0, 0, width.toDouble(), width.toDouble()), boxPaint);
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart
index cc5fd25..f8072ee 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart
@@ -10,7 +10,7 @@
import 'page.dart';
class AnimateCameraPage extends GoogleMapExampleAppPage {
- AnimateCameraPage()
+ const AnimateCameraPage()
: super(const Icon(Icons.map), 'Camera control, animated');
@override
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart
index f6d6f54..0ecc5ed 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart
@@ -13,7 +13,7 @@
CameraPosition(target: LatLng(-33.852, 151.211), zoom: 11.0);
class LiteModePage extends GoogleMapExampleAppPage {
- LiteModePage() : super(const Icon(Icons.map), 'Lite mode');
+ const LiteModePage() : super(const Icon(Icons.map), 'Lite mode');
@override
Widget build(BuildContext context) {
@@ -26,9 +26,9 @@
@override
Widget build(BuildContext context) {
- return Card(
+ return const Card(
child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 30.0),
+ padding: EdgeInsets.symmetric(vertical: 30.0),
child: Center(
child: SizedBox(
width: 300.0,
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart
index f67e4ff..f4d420a 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart
@@ -26,21 +26,21 @@
import 'tile_overlay.dart';
final List<GoogleMapExampleAppPage> _allPages = <GoogleMapExampleAppPage>[
- MapUiPage(),
- MapCoordinatesPage(),
- MapClickPage(),
- AnimateCameraPage(),
- MoveCameraPage(),
- PlaceMarkerPage(),
- MarkerIconsPage(),
- ScrollingMapPage(),
- PlacePolylinePage(),
- PlacePolygonPage(),
- PlaceCirclePage(),
- PaddingPage(),
- SnapshotPage(),
- LiteModePage(),
- TileOverlayPage(),
+ const MapUiPage(),
+ const MapCoordinatesPage(),
+ const MapClickPage(),
+ const AnimateCameraPage(),
+ const MoveCameraPage(),
+ const PlaceMarkerPage(),
+ const MarkerIconsPage(),
+ const ScrollingMapPage(),
+ const PlacePolylinePage(),
+ const PlacePolygonPage(),
+ const PlaceCirclePage(),
+ const PaddingPage(),
+ const SnapshotPage(),
+ const LiteModePage(),
+ const TileOverlayPage(),
];
class MapsDemo extends StatelessWidget {
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart
index e44f3d9..ef1bfe2 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart
@@ -13,7 +13,7 @@
CameraPosition(target: LatLng(-33.852, 151.211), zoom: 11.0);
class MapClickPage extends GoogleMapExampleAppPage {
- MapClickPage() : super(const Icon(Icons.mouse), 'Map click');
+ const MapClickPage() : super(const Icon(Icons.mouse), 'Map click');
@override
Widget build(BuildContext context) {
@@ -96,7 +96,7 @@
);
}
- void onMapCreated(GoogleMapController controller) async {
+ Future<void> onMapCreated(GoogleMapController controller) async {
setState(() {
mapController = controller;
});
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart
index 99ab168..dc4376a 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart
@@ -13,7 +13,7 @@
CameraPosition(target: LatLng(-33.852, 151.211), zoom: 11.0);
class MapCoordinatesPage extends GoogleMapExampleAppPage {
- MapCoordinatesPage() : super(const Icon(Icons.map), 'Map coordinates');
+ const MapCoordinatesPage() : super(const Icon(Icons.map), 'Map coordinates');
@override
Widget build(BuildContext context) {
@@ -72,7 +72,7 @@
);
}
- void onMapCreated(GoogleMapController controller) async {
+ Future<void> onMapCreated(GoogleMapController controller) async {
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
setState(() {
mapController = controller;
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart
index 2e0d2d1..48ef1f5 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart
@@ -16,7 +16,7 @@
);
class MapUiPage extends GoogleMapExampleAppPage {
- MapUiPage() : super(const Icon(Icons.map), 'User interface');
+ const MapUiPage() : super(const Icon(Icons.map), 'User interface');
@override
Widget build(BuildContext context) {
@@ -34,14 +34,14 @@
class MapUiBodyState extends State<MapUiBody> {
MapUiBodyState();
- static final CameraPosition _kInitialPosition = const CameraPosition(
+ static const CameraPosition _kInitialPosition = CameraPosition(
target: LatLng(-33.852, 151.211),
zoom: 11.0,
);
CameraPosition _position = _kInitialPosition;
bool _isMapCreated = false;
- bool _isMoving = false;
+ final bool _isMoving = false;
bool _compassEnabled = true;
bool _mapToolbarEnabled = true;
CameraTargetBounds _cameraTargetBounds = CameraTargetBounds.unbounded;
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart
index da57b83..95ace9d 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart
@@ -11,7 +11,7 @@
import 'page.dart';
class MarkerIconsPage extends GoogleMapExampleAppPage {
- MarkerIconsPage() : super(const Icon(Icons.image), 'Marker icons');
+ const MarkerIconsPage() : super(const Icon(Icons.image), 'Marker icons');
@override
Widget build(BuildContext context) {
@@ -60,13 +60,13 @@
Marker _createMarker() {
if (_markerIcon != null) {
return Marker(
- markerId: MarkerId("marker_1"),
+ markerId: const MarkerId('marker_1'),
position: _kMapCenter,
icon: _markerIcon!,
);
} else {
- return Marker(
- markerId: MarkerId("marker_1"),
+ return const Marker(
+ markerId: MarkerId('marker_1'),
position: _kMapCenter,
);
}
@@ -75,7 +75,7 @@
Future<void> _createMarkerImageFromAsset(BuildContext context) async {
if (_markerIcon == null) {
final ImageConfiguration imageConfiguration =
- createLocalImageConfiguration(context, size: Size.square(48));
+ createLocalImageConfiguration(context, size: const Size.square(48));
BitmapDescriptor.fromAssetImage(
imageConfiguration, 'assets/red_square.png')
.then(_updateBitmap);
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart
index f827419..33da90f 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart
@@ -10,7 +10,7 @@
import 'page.dart';
class MoveCameraPage extends GoogleMapExampleAppPage {
- MoveCameraPage() : super(const Icon(Icons.map), 'Camera control');
+ const MoveCameraPage() : super(const Icon(Icons.map), 'Camera control');
@override
Widget build(BuildContext context) {
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart
index d90005f..7709190 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart
@@ -9,7 +9,7 @@
import 'page.dart';
class PaddingPage extends GoogleMapExampleAppPage {
- PaddingPage() : super(const Icon(Icons.map), 'Add padding to the map');
+ const PaddingPage() : super(const Icon(Icons.map), 'Add padding to the map');
@override
Widget build(BuildContext context) {
@@ -53,11 +53,11 @@
),
),
),
- Padding(
- padding: const EdgeInsets.only(top: 20),
+ const Padding(
+ padding: EdgeInsets.only(top: 20),
child: Center(
child: Text(
- "Enter Padding Below",
+ 'Enter Padding Below',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
),
@@ -79,10 +79,10 @@
});
}
- TextEditingController _topController = TextEditingController();
- TextEditingController _bottomController = TextEditingController();
- TextEditingController _leftController = TextEditingController();
- TextEditingController _rightController = TextEditingController();
+ final TextEditingController _topController = TextEditingController();
+ final TextEditingController _bottomController = TextEditingController();
+ final TextEditingController _leftController = TextEditingController();
+ final TextEditingController _rightController = TextEditingController();
Widget _paddingInput() {
return Padding(
@@ -96,7 +96,7 @@
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
decoration: const InputDecoration(
- hintText: "Top",
+ hintText: 'Top',
),
),
),
@@ -108,7 +108,7 @@
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
decoration: const InputDecoration(
- hintText: "Bottom",
+ hintText: 'Bottom',
),
),
),
@@ -120,7 +120,7 @@
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
decoration: const InputDecoration(
- hintText: "Left",
+ hintText: 'Left',
),
),
),
@@ -132,7 +132,7 @@
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
decoration: const InputDecoration(
- hintText: "Right",
+ hintText: 'Right',
),
),
),
@@ -148,7 +148,7 @@
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
TextButton(
- child: const Text("Set Padding"),
+ child: const Text('Set Padding'),
onPressed: () {
setState(() {
_padding = EdgeInsets.fromLTRB(
@@ -160,7 +160,7 @@
},
),
TextButton(
- child: const Text("Reset Padding"),
+ child: const Text('Reset Padding'),
onPressed: () {
setState(() {
_topController.clear();
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart
index a495342..c6f1509 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart
@@ -10,7 +10,8 @@
import 'page.dart';
class PlaceCirclePage extends GoogleMapExampleAppPage {
- PlaceCirclePage() : super(const Icon(Icons.linear_scale), 'Place circle');
+ const PlaceCirclePage()
+ : super(const Icon(Icons.linear_scale), 'Place circle');
@override
Widget build(BuildContext context) {
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart
index 4b9496f..4291cac 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart
@@ -6,8 +6,8 @@
import 'dart:async';
import 'dart:math';
-import 'dart:ui';
import 'dart:typed_data';
+import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
@@ -15,7 +15,7 @@
import 'page.dart';
class PlaceMarkerPage extends GoogleMapExampleAppPage {
- PlaceMarkerPage() : super(const Icon(Icons.place), 'Place marker');
+ const PlaceMarkerPage() : super(const Icon(Icons.place), 'Place marker');
@override
Widget build(BuildContext context) {
@@ -34,7 +34,7 @@
class PlaceMarkerBodyState extends State<PlaceMarkerBody> {
PlaceMarkerBodyState();
- static final LatLng center = const LatLng(-33.86711, 151.1947171);
+ static const LatLng center = LatLng(-33.86711, 151.1947171);
GoogleMapController? controller;
Map<MarkerId, Marker> markers = <MarkerId, Marker>{};
@@ -74,17 +74,17 @@
}
}
- void _onMarkerDrag(MarkerId markerId, LatLng newPosition) async {
+ Future<void> _onMarkerDrag(MarkerId markerId, LatLng newPosition) async {
setState(() {
- this.markerPosition = newPosition;
+ markerPosition = newPosition;
});
}
- void _onMarkerDragEnd(MarkerId markerId, LatLng newPosition) async {
+ Future<void> _onMarkerDragEnd(MarkerId markerId, LatLng newPosition) async {
final Marker? tappedMarker = markers[markerId];
if (tappedMarker != null) {
setState(() {
- this.markerPosition = null;
+ markerPosition = null;
});
await showDialog<void>(
context: context,
@@ -289,7 +289,7 @@
@override
Widget build(BuildContext context) {
final MarkerId? selectedId = selectedMarker;
- return Stack(children: [
+ return Stack(children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -397,17 +397,19 @@
child: Container(
color: Colors.white70,
height: 30,
- padding: EdgeInsets.only(left: 12, right: 12),
+ padding: const EdgeInsets.only(left: 12, right: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
- children: [
- markerPosition == null
- ? Container()
- : Expanded(child: Text("lat: ${markerPosition!.latitude}")),
- markerPosition == null
- ? Container()
- : Expanded(child: Text("lng: ${markerPosition!.longitude}")),
+ children: <Widget>[
+ if (markerPosition == null)
+ Container()
+ else
+ Expanded(child: Text('lat: ${markerPosition!.latitude}')),
+ if (markerPosition == null)
+ Container()
+ else
+ Expanded(child: Text('lng: ${markerPosition!.longitude}')),
],
),
),
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart
index 476084d..8d4fa3e 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart
@@ -10,7 +10,8 @@
import 'page.dart';
class PlacePolygonPage extends GoogleMapExampleAppPage {
- PlacePolygonPage() : super(const Icon(Icons.linear_scale), 'Place polygon');
+ const PlacePolygonPage()
+ : super(const Icon(Icons.linear_scale), 'Place polygon');
@override
Widget build(BuildContext context) {
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart
index aeb9bf1..434920d 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart
@@ -11,7 +11,8 @@
import 'page.dart';
class PlacePolylinePage extends GoogleMapExampleAppPage {
- PlacePolylinePage() : super(const Icon(Icons.linear_scale), 'Place polyline');
+ const PlacePolylinePage()
+ : super(const Icon(Icons.linear_scale), 'Place polyline');
@override
Widget build(BuildContext context) {
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart
index 9611d36..8d046fc 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart
@@ -12,8 +12,10 @@
import 'page.dart';
+const LatLng _center = LatLng(32.080664, 34.9563837);
+
class ScrollingMapPage extends GoogleMapExampleAppPage {
- ScrollingMapPage() : super(const Icon(Icons.map), 'Scrolling map');
+ const ScrollingMapPage() : super(const Icon(Icons.map), 'Scrolling map');
@override
Widget build(BuildContext context) {
@@ -24,8 +26,6 @@
class ScrollingMapBody extends StatelessWidget {
const ScrollingMapBody();
- final LatLng center = const LatLng(32.080664, 34.9563837);
-
@override
Widget build(BuildContext context) {
return ListView(
@@ -44,8 +44,8 @@
width: 300.0,
height: 300.0,
child: GoogleMap(
- initialCameraPosition: CameraPosition(
- target: center,
+ initialCameraPosition: const CameraPosition(
+ target: _center,
zoom: 11.0,
),
gestureRecognizers: //
@@ -77,16 +77,16 @@
width: 300.0,
height: 300.0,
child: GoogleMap(
- initialCameraPosition: CameraPosition(
- target: center,
+ initialCameraPosition: const CameraPosition(
+ target: _center,
zoom: 11.0,
),
markers: <Marker>{
Marker(
- markerId: MarkerId("test_marker_id"),
+ markerId: const MarkerId('test_marker_id'),
position: LatLng(
- center.latitude,
- center.longitude,
+ _center.latitude,
+ _center.longitude,
),
infoWindow: const InfoWindow(
title: 'An interesting location',
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart
index c85048f..9afc288 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart
@@ -15,7 +15,7 @@
CameraPosition(target: LatLng(-33.852, 151.211), zoom: 11.0);
class SnapshotPage extends GoogleMapExampleAppPage {
- SnapshotPage()
+ const SnapshotPage()
: super(const Icon(Icons.camera_alt), 'Take a snapshot of the map');
@override
@@ -39,7 +39,7 @@
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
+ children: <Widget>[
SizedBox(
height: 180,
child: GoogleMap(
@@ -48,9 +48,10 @@
),
),
TextButton(
- child: Text('Take a snapshot'),
+ child: const Text('Take a snapshot'),
onPressed: () async {
- final imageBytes = await _mapController?.takeSnapshot();
+ final Uint8List? imageBytes =
+ await _mapController?.takeSnapshot();
setState(() {
_imageBytes = imageBytes;
});
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart
index 1d6dd69..dc7f7d1 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart
@@ -13,7 +13,7 @@
import 'page.dart';
class TileOverlayPage extends GoogleMapExampleAppPage {
- TileOverlayPage() : super(const Icon(Icons.map), 'Tile overlay');
+ const TileOverlayPage() : super(const Icon(Icons.map), 'Tile overlay');
@override
Widget build(BuildContext context) {
@@ -51,7 +51,7 @@
void _addTileOverlay() {
final TileOverlay tileOverlay = TileOverlay(
- tileOverlayId: TileOverlayId('tile_overlay_1'),
+ tileOverlayId: const TileOverlayId('tile_overlay_1'),
tileProvider: _DebugTileProvider(),
);
setState(() {
@@ -67,7 +67,7 @@
@override
Widget build(BuildContext context) {
- Set<TileOverlay> overlays = <TileOverlay>{
+ final Set<TileOverlay> overlays = <TileOverlay>{
if (_tileOverlay != null) _tileOverlay!,
};
return Column(
@@ -117,7 +117,7 @@
static const int width = 100;
static const int height = 100;
static final Paint boxPaint = Paint();
- static final TextStyle textStyle = TextStyle(
+ static const TextStyle textStyle = TextStyle(
color: Colors.red,
fontSize: 20,
);
@@ -138,7 +138,7 @@
minWidth: 0.0,
maxWidth: width.toDouble(),
);
- final Offset offset = const Offset(0, 0);
+ const Offset offset = Offset(0, 0);
textPainter.paint(canvas, offset);
canvas.drawRect(
Rect.fromLTRB(0, 0, width.toDouble(), width.toDouble()), boxPaint);
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
index cd614c7..dbc32b0 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
+++ b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
@@ -7,10 +7,10 @@
flutter: ">=2.5.0"
dependencies:
+ cupertino_icons: ^0.1.0
flutter:
sdk: flutter
-
- cupertino_icons: ^0.1.0
+ flutter_plugin_android_lifecycle: ^2.0.1
google_maps_flutter:
# When depending on this package from a real application you should use:
# google_maps_flutter: ^x.y.z
@@ -18,7 +18,6 @@
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
- flutter_plugin_android_lifecycle: ^2.0.1
dev_dependencies:
espresso: ^0.1.0+2
@@ -26,7 +25,6 @@
sdk: flutter
integration_test:
sdk: flutter
- pedantic: ^1.10.0
flutter:
uses-material-design: true
diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart
index 93bb056..5b1e67c 100644
--- a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart
@@ -14,7 +14,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
-import 'package:google_maps_flutter_platform_interface/src/method_channel/method_channel_google_maps_flutter.dart';
export 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'
show
diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
index d57ac97..088589e 100644
--- a/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
@@ -6,17 +6,16 @@
/// Controller for a single GoogleMap instance running on the host platform.
class GoogleMapController {
- /// The mapId for this controller
- final int mapId;
-
GoogleMapController._(
- CameraPosition initialCameraPosition,
this._googleMapState, {
required this.mapId,
}) {
_connectStreams(mapId);
}
+ /// The mapId for this controller
+ final int mapId;
+
/// Initialize control of a [GoogleMap] with [id].
///
/// Mainly for internal use when instantiating a [GoogleMapController] passed
@@ -29,7 +28,6 @@
assert(id != null);
await GoogleMapsFlutterPlatform.instance.init(id);
return GoogleMapController._(
- initialCameraPosition,
googleMapState,
mapId: id,
);
@@ -38,7 +36,7 @@
/// Used to communicate with the native platform.
///
/// Accessible only for testing.
- // TODO(dit) https://github.com/flutter/flutter/issues/55504 Remove this getter.
+ // TODO(dit): Remove this getter, https://github.com/flutter/flutter/issues/55504.
@visibleForTesting
MethodChannel? get channel {
if (GoogleMapsFlutterPlatform.instance is MethodChannelGoogleMapsFlutter) {
diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart
index b153832..8ecbfbb 100644
--- a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart
@@ -25,11 +25,12 @@
final String objectType;
/// The unknown maps object ID.
- final MapsObjectId objectId;
+ final MapsObjectId<Object> objectId;
/// The context where the error occurred.
final String? context;
+ @override
String toString() {
if (context != null) {
return 'Unknown $objectType ID "${objectId.value}" in $context';
@@ -40,6 +41,8 @@
/// Android specific settings for [GoogleMap].
class AndroidGoogleMapsFlutter {
+ AndroidGoogleMapsFlutter._();
+
/// Whether to render [GoogleMap] with a [AndroidViewSurface] to build the Google Maps widget.
///
/// This implementation uses hybrid composition to render the Google Maps
@@ -282,7 +285,7 @@
}
class _GoogleMapState extends State<GoogleMap> {
- final _mapId = _nextMapCreationId++;
+ final int _mapId = _nextMapCreationId++;
final Completer<GoogleMapController> _controller =
Completer<GoogleMapController>();
@@ -322,9 +325,13 @@
}
@override
- void dispose() async {
+ void dispose() {
+ _disposeController();
super.dispose();
- GoogleMapController controller = await _controller.future;
+ }
+
+ Future<void> _disposeController() async {
+ final GoogleMapController controller = await _controller.future;
controller.dispose();
}
@@ -339,7 +346,7 @@
_updateTileOverlays();
}
- void _updateOptions() async {
+ Future<void> _updateOptions() async {
final _GoogleMapOptions newOptions = _GoogleMapOptions.fromWidget(widget);
final Map<String, dynamic> updates =
_googleMapOptions.updatesMap(newOptions);
@@ -352,7 +359,7 @@
_googleMapOptions = newOptions;
}
- void _updateMarkers() async {
+ Future<void> _updateMarkers() async {
final GoogleMapController controller = await _controller.future;
// ignore: unawaited_futures
controller._updateMarkers(
@@ -360,7 +367,7 @@
_markers = keyByMarkerId(widget.markers);
}
- void _updatePolygons() async {
+ Future<void> _updatePolygons() async {
final GoogleMapController controller = await _controller.future;
// ignore: unawaited_futures
controller._updatePolygons(
@@ -368,7 +375,7 @@
_polygons = keyByPolygonId(widget.polygons);
}
- void _updatePolylines() async {
+ Future<void> _updatePolylines() async {
final GoogleMapController controller = await _controller.future;
// ignore: unawaited_futures
controller._updatePolylines(
@@ -376,7 +383,7 @@
_polylines = keyByPolylineId(widget.polylines);
}
- void _updateCircles() async {
+ Future<void> _updateCircles() async {
final GoogleMapController controller = await _controller.future;
// ignore: unawaited_futures
controller._updateCircles(
@@ -384,7 +391,7 @@
_circles = keyByCircleId(widget.circles);
}
- void _updateTileOverlays() async {
+ Future<void> _updateTileOverlays() async {
final GoogleMapController controller = await _controller.future;
// ignore: unawaited_futures
controller._updateTileOverlays(widget.tileOverlays);
diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
index e8bd391..849019c 100644
--- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
+++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
@@ -2,7 +2,7 @@
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
repository: https://github.com/flutter/plugins/tree/main/packages/google_maps_flutter/google_maps_flutter
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
-version: 2.1.1
+version: 2.1.2
environment:
sdk: ">=2.14.0 <3.0.0"
diff --git a/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart
index e0d1180..6d65066 100644
--- a/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart
@@ -35,7 +35,7 @@
});
testWidgets('Initializing a circle', (WidgetTester tester) async {
- final Circle c1 = Circle(circleId: CircleId("circle_1"));
+ const Circle c1 = Circle(circleId: CircleId('circle_1'));
await tester.pumpWidget(_mapWithCircles(<Circle>{c1}));
final FakePlatformGoogleMap platformGoogleMap =
@@ -48,9 +48,9 @@
expect(platformGoogleMap.circlesToChange.isEmpty, true);
});
- testWidgets("Adding a circle", (WidgetTester tester) async {
- final Circle c1 = Circle(circleId: CircleId("circle_1"));
- final Circle c2 = Circle(circleId: CircleId("circle_2"));
+ testWidgets('Adding a circle', (WidgetTester tester) async {
+ const Circle c1 = Circle(circleId: CircleId('circle_1'));
+ const Circle c2 = Circle(circleId: CircleId('circle_2'));
await tester.pumpWidget(_mapWithCircles(<Circle>{c1}));
await tester.pumpWidget(_mapWithCircles(<Circle>{c1, c2}));
@@ -67,8 +67,8 @@
expect(platformGoogleMap.circlesToChange.isEmpty, true);
});
- testWidgets("Removing a circle", (WidgetTester tester) async {
- final Circle c1 = Circle(circleId: CircleId("circle_1"));
+ testWidgets('Removing a circle', (WidgetTester tester) async {
+ const Circle c1 = Circle(circleId: CircleId('circle_1'));
await tester.pumpWidget(_mapWithCircles(<Circle>{c1}));
await tester.pumpWidget(_mapWithCircles(<Circle>{}));
@@ -82,9 +82,9 @@
expect(platformGoogleMap.circlesToAdd.isEmpty, true);
});
- testWidgets("Updating a circle", (WidgetTester tester) async {
- final Circle c1 = Circle(circleId: CircleId("circle_1"));
- final Circle c2 = Circle(circleId: CircleId("circle_1"), radius: 10);
+ testWidgets('Updating a circle', (WidgetTester tester) async {
+ const Circle c1 = Circle(circleId: CircleId('circle_1'));
+ const Circle c2 = Circle(circleId: CircleId('circle_1'), radius: 10);
await tester.pumpWidget(_mapWithCircles(<Circle>{c1}));
await tester.pumpWidget(_mapWithCircles(<Circle>{c2}));
@@ -98,9 +98,9 @@
expect(platformGoogleMap.circlesToAdd.isEmpty, true);
});
- testWidgets("Updating a circle", (WidgetTester tester) async {
- final Circle c1 = Circle(circleId: CircleId("circle_1"));
- final Circle c2 = Circle(circleId: CircleId("circle_1"), radius: 10);
+ testWidgets('Updating a circle', (WidgetTester tester) async {
+ const Circle c1 = Circle(circleId: CircleId('circle_1'));
+ const Circle c2 = Circle(circleId: CircleId('circle_1'), radius: 10);
await tester.pumpWidget(_mapWithCircles(<Circle>{c1}));
await tester.pumpWidget(_mapWithCircles(<Circle>{c2}));
@@ -114,12 +114,12 @@
expect(update.radius, 10);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Circle c1 = Circle(circleId: CircleId("circle_1"));
- Circle c2 = Circle(circleId: CircleId("circle_2"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Circle c1 = const Circle(circleId: CircleId('circle_1'));
+ Circle c2 = const Circle(circleId: CircleId('circle_2'));
final Set<Circle> prev = <Circle>{c1, c2};
- c1 = Circle(circleId: CircleId("circle_1"), visible: false);
- c2 = Circle(circleId: CircleId("circle_2"), radius: 10);
+ c1 = const Circle(circleId: CircleId('circle_1'), visible: false);
+ c2 = const Circle(circleId: CircleId('circle_2'), radius: 10);
final Set<Circle> cur = <Circle>{c1, c2};
await tester.pumpWidget(_mapWithCircles(prev));
@@ -133,14 +133,14 @@
expect(platformGoogleMap.circlesToAdd.isEmpty, true);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Circle c2 = Circle(circleId: CircleId("circle_2"));
- final Circle c3 = Circle(circleId: CircleId("circle_3"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Circle c2 = const Circle(circleId: CircleId('circle_2'));
+ const Circle c3 = Circle(circleId: CircleId('circle_3'));
final Set<Circle> prev = <Circle>{c2, c3};
// c1 is added, c2 is updated, c3 is removed.
- final Circle c1 = Circle(circleId: CircleId("circle_1"));
- c2 = Circle(circleId: CircleId("circle_2"), radius: 10);
+ const Circle c1 = Circle(circleId: CircleId('circle_1'));
+ c2 = const Circle(circleId: CircleId('circle_2'), radius: 10);
final Set<Circle> cur = <Circle>{c1, c2};
await tester.pumpWidget(_mapWithCircles(prev));
@@ -158,12 +158,12 @@
expect(platformGoogleMap.circleIdsToRemove.first, equals(c3.circleId));
});
- testWidgets("Partial Update", (WidgetTester tester) async {
- final Circle c1 = Circle(circleId: CircleId("circle_1"));
- final Circle c2 = Circle(circleId: CircleId("circle_2"));
- Circle c3 = Circle(circleId: CircleId("circle_3"));
+ testWidgets('Partial Update', (WidgetTester tester) async {
+ const Circle c1 = Circle(circleId: CircleId('circle_1'));
+ const Circle c2 = Circle(circleId: CircleId('circle_2'));
+ Circle c3 = const Circle(circleId: CircleId('circle_3'));
final Set<Circle> prev = <Circle>{c1, c2, c3};
- c3 = Circle(circleId: CircleId("circle_3"), radius: 10);
+ c3 = const Circle(circleId: CircleId('circle_3'), radius: 10);
final Set<Circle> cur = <Circle>{c1, c2, c3};
await tester.pumpWidget(_mapWithCircles(prev));
@@ -177,10 +177,11 @@
expect(platformGoogleMap.circlesToAdd.isEmpty, true);
});
- testWidgets("Update non platform related attr", (WidgetTester tester) async {
- Circle c1 = Circle(circleId: CircleId("circle_1"));
+ testWidgets('Update non platform related attr', (WidgetTester tester) async {
+ Circle c1 = const Circle(circleId: CircleId('circle_1'));
final Set<Circle> prev = <Circle>{c1};
- c1 = Circle(circleId: CircleId("circle_1"), onTap: () => print("hello"));
+ c1 = Circle(
+ circleId: const CircleId('circle_1'), onTap: () => print('hello'));
final Set<Circle> cur = <Circle>{c1};
await tester.pumpWidget(_mapWithCircles(prev));
diff --git a/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart b/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart
index 37270ea..bac3cea 100644
--- a/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart
@@ -15,7 +15,7 @@
channel = MethodChannel(
'plugins.flutter.io/google_maps_$id', const StandardMethodCodec()) {
channel.setMockMethodCallHandler(onMethodCall);
- updateOptions(params['options']);
+ updateOptions(params['options'] as Map<dynamic, dynamic>);
updateMarkers(params);
updatePolygons(params);
updatePolylines(params);
@@ -94,23 +94,23 @@
Future<dynamic> onMethodCall(MethodCall call) {
switch (call.method) {
case 'map#update':
- updateOptions(call.arguments['options']);
+ updateOptions(call.arguments['options'] as Map<dynamic, dynamic>);
return Future<void>.sync(() {});
case 'markers#update':
- updateMarkers(call.arguments);
+ updateMarkers(call.arguments as Map<dynamic, dynamic>?);
return Future<void>.sync(() {});
case 'polygons#update':
- updatePolygons(call.arguments);
+ updatePolygons(call.arguments as Map<dynamic, dynamic>?);
return Future<void>.sync(() {});
case 'polylines#update':
- updatePolylines(call.arguments);
+ updatePolylines(call.arguments as Map<dynamic, dynamic>?);
return Future<void>.sync(() {});
case 'tileOverlays#update':
- updateTileOverlays(
- Map.castFrom<dynamic, dynamic, String, dynamic>(call.arguments));
+ updateTileOverlays(Map.castFrom<dynamic, dynamic, String, dynamic>(
+ call.arguments as Map<dynamic, dynamic>));
return Future<void>.sync(() {});
case 'circles#update':
- updateCircles(call.arguments);
+ updateCircles(call.arguments as Map<dynamic, dynamic>?);
return Future<void>.sync(() {});
default:
return Future<void>.sync(() {});
@@ -122,8 +122,8 @@
return;
}
markersToAdd = _deserializeMarkers(markerUpdates['markersToAdd']);
- markerIdsToRemove =
- _deserializeMarkerIds(markerUpdates['markerIdsToRemove']);
+ markerIdsToRemove = _deserializeMarkerIds(
+ markerUpdates['markerIdsToRemove'] as List<dynamic>?);
markersToChange = _deserializeMarkers(markerUpdates['markersToChange']);
}
@@ -131,29 +131,32 @@
if (markerIds == null) {
return <MarkerId>{};
}
- return markerIds.map((dynamic markerId) => MarkerId(markerId)).toSet();
+ return markerIds
+ .map((dynamic markerId) => MarkerId(markerId as String))
+ .toSet();
}
Set<Marker> _deserializeMarkers(dynamic markers) {
if (markers == null) {
return <Marker>{};
}
- final List<dynamic> markersData = markers;
+ final List<dynamic> markersData = markers as List<dynamic>;
final Set<Marker> result = <Marker>{};
- for (Map<dynamic, dynamic> markerData
+ for (final Map<dynamic, dynamic> markerData
in markersData.cast<Map<dynamic, dynamic>>()) {
- final String markerId = markerData['markerId'];
- final double alpha = markerData['alpha'];
- final bool draggable = markerData['draggable'];
- final bool visible = markerData['visible'];
+ final String markerId = markerData['markerId'] as String;
+ final double alpha = markerData['alpha'] as double;
+ final bool draggable = markerData['draggable'] as bool;
+ final bool visible = markerData['visible'] as bool;
final dynamic infoWindowData = markerData['infoWindow'];
InfoWindow infoWindow = InfoWindow.noText;
if (infoWindowData != null) {
- final Map<dynamic, dynamic> infoWindowMap = infoWindowData;
+ final Map<dynamic, dynamic> infoWindowMap =
+ infoWindowData as Map<dynamic, dynamic>;
infoWindow = InfoWindow(
- title: infoWindowMap['title'],
- snippet: infoWindowMap['snippet'],
+ title: infoWindowMap['title'] as String?,
+ snippet: infoWindowMap['snippet'] as String?,
);
}
@@ -174,8 +177,8 @@
return;
}
polygonsToAdd = _deserializePolygons(polygonUpdates['polygonsToAdd']);
- polygonIdsToRemove =
- _deserializePolygonIds(polygonUpdates['polygonIdsToRemove']);
+ polygonIdsToRemove = _deserializePolygonIds(
+ polygonUpdates['polygonIdsToRemove'] as List<dynamic>?);
polygonsToChange = _deserializePolygons(polygonUpdates['polygonsToChange']);
}
@@ -183,22 +186,26 @@
if (polygonIds == null) {
return <PolygonId>{};
}
- return polygonIds.map((dynamic polygonId) => PolygonId(polygonId)).toSet();
+ return polygonIds
+ .map((dynamic polygonId) => PolygonId(polygonId as String))
+ .toSet();
}
Set<Polygon> _deserializePolygons(dynamic polygons) {
if (polygons == null) {
return <Polygon>{};
}
- final List<dynamic> polygonsData = polygons;
+ final List<dynamic> polygonsData = polygons as List<dynamic>;
final Set<Polygon> result = <Polygon>{};
- for (Map<dynamic, dynamic> polygonData
+ for (final Map<dynamic, dynamic> polygonData
in polygonsData.cast<Map<dynamic, dynamic>>()) {
- final String polygonId = polygonData['polygonId'];
- final bool visible = polygonData['visible'];
- final bool geodesic = polygonData['geodesic'];
- final List<LatLng> points = _deserializePoints(polygonData['points']);
- final List<List<LatLng>> holes = _deserializeHoles(polygonData['holes']);
+ final String polygonId = polygonData['polygonId'] as String;
+ final bool visible = polygonData['visible'] as bool;
+ final bool geodesic = polygonData['geodesic'] as bool;
+ final List<LatLng> points =
+ _deserializePoints(polygonData['points'] as List<dynamic>);
+ final List<List<LatLng>> holes =
+ _deserializeHoles(polygonData['holes'] as List<dynamic>);
result.add(Polygon(
polygonId: PolygonId(polygonId),
@@ -214,15 +221,15 @@
List<LatLng> _deserializePoints(List<dynamic> points) {
return points.map<LatLng>((dynamic list) {
- return LatLng(list[0], list[1]);
+ return LatLng(list[0] as double, list[1] as double);
}).toList();
}
List<List<LatLng>> _deserializeHoles(List<dynamic> holes) {
return holes.map<List<LatLng>>((dynamic hole) {
return hole.map<LatLng>((dynamic list) {
- return LatLng(list[0], list[1]);
- }).toList();
+ return LatLng(list[0] as double, list[1] as double);
+ }).toList() as List<LatLng>;
}).toList();
}
@@ -231,8 +238,8 @@
return;
}
polylinesToAdd = _deserializePolylines(polylineUpdates['polylinesToAdd']);
- polylineIdsToRemove =
- _deserializePolylineIds(polylineUpdates['polylineIdsToRemove']);
+ polylineIdsToRemove = _deserializePolylineIds(
+ polylineUpdates['polylineIdsToRemove'] as List<dynamic>?);
polylinesToChange =
_deserializePolylines(polylineUpdates['polylinesToChange']);
}
@@ -242,7 +249,7 @@
return <PolylineId>{};
}
return polylineIds
- .map((dynamic polylineId) => PolylineId(polylineId))
+ .map((dynamic polylineId) => PolylineId(polylineId as String))
.toSet();
}
@@ -250,14 +257,15 @@
if (polylines == null) {
return <Polyline>{};
}
- final List<dynamic> polylinesData = polylines;
+ final List<dynamic> polylinesData = polylines as List<dynamic>;
final Set<Polyline> result = <Polyline>{};
- for (Map<dynamic, dynamic> polylineData
+ for (final Map<dynamic, dynamic> polylineData
in polylinesData.cast<Map<dynamic, dynamic>>()) {
- final String polylineId = polylineData['polylineId'];
- final bool visible = polylineData['visible'];
- final bool geodesic = polylineData['geodesic'];
- final List<LatLng> points = _deserializePoints(polylineData['points']);
+ final String polylineId = polylineData['polylineId'] as String;
+ final bool visible = polylineData['visible'] as bool;
+ final bool geodesic = polylineData['geodesic'] as bool;
+ final List<LatLng> points =
+ _deserializePoints(polylineData['points'] as List<dynamic>);
result.add(Polyline(
polylineId: PolylineId(polylineId),
@@ -275,8 +283,8 @@
return;
}
circlesToAdd = _deserializeCircles(circleUpdates['circlesToAdd']);
- circleIdsToRemove =
- _deserializeCircleIds(circleUpdates['circleIdsToRemove']);
+ circleIdsToRemove = _deserializeCircleIds(
+ circleUpdates['circleIdsToRemove'] as List<dynamic>?);
circlesToChange = _deserializeCircles(circleUpdates['circlesToChange']);
}
@@ -287,17 +295,19 @@
final List<Map<dynamic, dynamic>>? tileOverlaysToAddList =
updateTileOverlayUpdates['tileOverlaysToAdd'] != null
? List.castFrom<dynamic, Map<dynamic, dynamic>>(
- updateTileOverlayUpdates['tileOverlaysToAdd'])
+ updateTileOverlayUpdates['tileOverlaysToAdd'] as List<dynamic>)
: null;
final List<String>? tileOverlayIdsToRemoveList =
updateTileOverlayUpdates['tileOverlayIdsToRemove'] != null
? List.castFrom<dynamic, String>(
- updateTileOverlayUpdates['tileOverlayIdsToRemove'])
+ updateTileOverlayUpdates['tileOverlayIdsToRemove']
+ as List<dynamic>)
: null;
final List<Map<dynamic, dynamic>>? tileOverlaysToChangeList =
updateTileOverlayUpdates['tileOverlaysToChange'] != null
? List.castFrom<dynamic, Map<dynamic, dynamic>>(
- updateTileOverlayUpdates['tileOverlaysToChange'])
+ updateTileOverlayUpdates['tileOverlaysToChange']
+ as List<dynamic>)
: null;
tileOverlaysToAdd = _deserializeTileOverlays(tileOverlaysToAddList);
tileOverlayIdsToRemove =
@@ -309,20 +319,22 @@
if (circleIds == null) {
return <CircleId>{};
}
- return circleIds.map((dynamic circleId) => CircleId(circleId)).toSet();
+ return circleIds
+ .map((dynamic circleId) => CircleId(circleId as String))
+ .toSet();
}
Set<Circle> _deserializeCircles(dynamic circles) {
if (circles == null) {
return <Circle>{};
}
- final List<dynamic> circlesData = circles;
+ final List<dynamic> circlesData = circles as List<dynamic>;
final Set<Circle> result = <Circle>{};
- for (Map<dynamic, dynamic> circleData
+ for (final Map<dynamic, dynamic> circleData
in circlesData.cast<Map<dynamic, dynamic>>()) {
- final String circleId = circleData['circleId'];
- final bool visible = circleData['visible'];
- final double radius = circleData['radius'];
+ final String circleId = circleData['circleId'] as String;
+ final bool visible = circleData['visible'] as bool;
+ final double radius = circleData['radius'] as double;
result.add(Circle(
circleId: CircleId(circleId),
@@ -349,12 +361,12 @@
return <TileOverlay>{};
}
final Set<TileOverlay> result = <TileOverlay>{};
- for (Map<dynamic, dynamic> tileOverlayData in tileOverlays) {
- final String tileOverlayId = tileOverlayData['tileOverlayId'];
- final bool fadeIn = tileOverlayData['fadeIn'];
- final double transparency = tileOverlayData['transparency'];
- final int zIndex = tileOverlayData['zIndex'];
- final bool visible = tileOverlayData['visible'];
+ for (final Map<dynamic, dynamic> tileOverlayData in tileOverlays) {
+ final String tileOverlayId = tileOverlayData['tileOverlayId'] as String;
+ final bool fadeIn = tileOverlayData['fadeIn'] as bool;
+ final double transparency = tileOverlayData['transparency'] as double;
+ final int zIndex = tileOverlayData['zIndex'] as int;
+ final bool visible = tileOverlayData['visible'] as bool;
result.add(TileOverlay(
tileOverlayId: TileOverlayId(tileOverlayId),
@@ -370,60 +382,62 @@
void updateOptions(Map<dynamic, dynamic> options) {
if (options.containsKey('compassEnabled')) {
- compassEnabled = options['compassEnabled'];
+ compassEnabled = options['compassEnabled'] as bool?;
}
if (options.containsKey('mapToolbarEnabled')) {
- mapToolbarEnabled = options['mapToolbarEnabled'];
+ mapToolbarEnabled = options['mapToolbarEnabled'] as bool?;
}
if (options.containsKey('cameraTargetBounds')) {
- final List<dynamic> boundsList = options['cameraTargetBounds'];
+ final List<dynamic> boundsList =
+ options['cameraTargetBounds'] as List<dynamic>;
cameraTargetBounds = boundsList[0] == null
? CameraTargetBounds.unbounded
: CameraTargetBounds(LatLngBounds.fromList(boundsList[0]));
}
if (options.containsKey('mapType')) {
- mapType = MapType.values[options['mapType']];
+ mapType = MapType.values[options['mapType'] as int];
}
if (options.containsKey('minMaxZoomPreference')) {
- final List<dynamic> minMaxZoomList = options['minMaxZoomPreference'];
- minMaxZoomPreference =
- MinMaxZoomPreference(minMaxZoomList[0], minMaxZoomList[1]);
+ final List<dynamic> minMaxZoomList =
+ options['minMaxZoomPreference'] as List<dynamic>;
+ minMaxZoomPreference = MinMaxZoomPreference(
+ minMaxZoomList[0] as double?, minMaxZoomList[1] as double?);
}
if (options.containsKey('rotateGesturesEnabled')) {
- rotateGesturesEnabled = options['rotateGesturesEnabled'];
+ rotateGesturesEnabled = options['rotateGesturesEnabled'] as bool?;
}
if (options.containsKey('scrollGesturesEnabled')) {
- scrollGesturesEnabled = options['scrollGesturesEnabled'];
+ scrollGesturesEnabled = options['scrollGesturesEnabled'] as bool?;
}
if (options.containsKey('tiltGesturesEnabled')) {
- tiltGesturesEnabled = options['tiltGesturesEnabled'];
+ tiltGesturesEnabled = options['tiltGesturesEnabled'] as bool?;
}
if (options.containsKey('trackCameraPosition')) {
- trackCameraPosition = options['trackCameraPosition'];
+ trackCameraPosition = options['trackCameraPosition'] as bool?;
}
if (options.containsKey('zoomGesturesEnabled')) {
- zoomGesturesEnabled = options['zoomGesturesEnabled'];
+ zoomGesturesEnabled = options['zoomGesturesEnabled'] as bool?;
}
if (options.containsKey('zoomControlsEnabled')) {
- zoomControlsEnabled = options['zoomControlsEnabled'];
+ zoomControlsEnabled = options['zoomControlsEnabled'] as bool?;
}
if (options.containsKey('liteModeEnabled')) {
- liteModeEnabled = options['liteModeEnabled'];
+ liteModeEnabled = options['liteModeEnabled'] as bool?;
}
if (options.containsKey('myLocationEnabled')) {
- myLocationEnabled = options['myLocationEnabled'];
+ myLocationEnabled = options['myLocationEnabled'] as bool?;
}
if (options.containsKey('myLocationButtonEnabled')) {
- myLocationButtonEnabled = options['myLocationButtonEnabled'];
+ myLocationButtonEnabled = options['myLocationButtonEnabled'] as bool?;
}
if (options.containsKey('trafficEnabled')) {
- trafficEnabled = options['trafficEnabled'];
+ trafficEnabled = options['trafficEnabled'] as bool?;
}
if (options.containsKey('buildingsEnabled')) {
- buildingsEnabled = options['buildingsEnabled'];
+ buildingsEnabled = options['buildingsEnabled'] as bool?;
}
if (options.containsKey('padding')) {
- padding = options['padding'];
+ padding = options['padding'] as List<dynamic>?;
}
}
}
@@ -434,10 +448,12 @@
Future<dynamic> fakePlatformViewsMethodHandler(MethodCall call) {
switch (call.method) {
case 'create':
- final Map<dynamic, dynamic> args = call.arguments;
- final Map<dynamic, dynamic> params = _decodeParams(args['params'])!;
+ final Map<dynamic, dynamic> args =
+ call.arguments as Map<dynamic, dynamic>;
+ final Map<dynamic, dynamic> params =
+ _decodeParams(args['params'] as Uint8List)!;
lastCreatedView = FakePlatformGoogleMap(
- args['id'],
+ args['id'] as int,
params,
);
return Future<int>.sync(() => 1);
@@ -457,5 +473,6 @@
paramsMessage.offsetInBytes,
paramsMessage.lengthInBytes,
);
- return const StandardMessageCodec().decodeMessage(messageBytes);
+ return const StandardMessageCodec().decodeMessage(messageBytes)
+ as Map<dynamic, dynamic>?;
}
diff --git a/packages/google_maps_flutter/google_maps_flutter/test/map_creation_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/map_creation_test.dart
index 6b3ac90..73e1e77 100644
--- a/packages/google_maps_flutter/google_maps_flutter/test/map_creation_test.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/test/map_creation_test.dart
@@ -32,7 +32,7 @@
Directionality(
textDirection: TextDirection.ltr,
child: Column(
- children: const [
+ children: const <Widget>[
GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(43.362, -5.849),
@@ -57,7 +57,7 @@
testWidgets('Calls platform.dispose when GoogleMap is disposed of', (
WidgetTester tester,
) async {
- await tester.pumpWidget(GoogleMap(
+ await tester.pumpWidget(const GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(43.3608, -5.8702),
),
@@ -81,8 +81,8 @@
bool disposed = false;
// Stream controller to inject events for testing.
- final StreamController<MapEvent> mapEventStreamController =
- StreamController<MapEvent>.broadcast();
+ final StreamController<MapEvent<dynamic>> mapEventStreamController =
+ StreamController<MapEvent<dynamic>>.broadcast();
@override
Future<void> init(int mapId) async {}
@@ -151,7 +151,8 @@
Future<LatLngBounds> getVisibleRegion({
required int mapId,
}) async {
- return LatLngBounds(southwest: LatLng(0, 0), northeast: LatLng(0, 0));
+ return LatLngBounds(
+ southwest: const LatLng(0, 0), northeast: const LatLng(0, 0));
}
@override
@@ -159,7 +160,7 @@
LatLng latLng, {
required int mapId,
}) async {
- return ScreenCoordinate(x: 0, y: 0);
+ return const ScreenCoordinate(x: 0, y: 0);
}
@override
@@ -167,7 +168,7 @@
ScreenCoordinate screenCoordinate, {
required int mapId,
}) async {
- return LatLng(0, 0);
+ return const LatLng(0, 0);
}
@override
diff --git a/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart
index e295393..b5bba55 100644
--- a/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart
@@ -35,7 +35,7 @@
});
testWidgets('Initializing a marker', (WidgetTester tester) async {
- final Marker m1 = Marker(markerId: MarkerId("marker_1"));
+ const Marker m1 = Marker(markerId: MarkerId('marker_1'));
await tester.pumpWidget(_mapWithMarkers(<Marker>{m1}));
final FakePlatformGoogleMap platformGoogleMap =
@@ -48,9 +48,9 @@
expect(platformGoogleMap.markersToChange.isEmpty, true);
});
- testWidgets("Adding a marker", (WidgetTester tester) async {
- final Marker m1 = Marker(markerId: MarkerId("marker_1"));
- final Marker m2 = Marker(markerId: MarkerId("marker_2"));
+ testWidgets('Adding a marker', (WidgetTester tester) async {
+ const Marker m1 = Marker(markerId: MarkerId('marker_1'));
+ const Marker m2 = Marker(markerId: MarkerId('marker_2'));
await tester.pumpWidget(_mapWithMarkers(<Marker>{m1}));
await tester.pumpWidget(_mapWithMarkers(<Marker>{m1, m2}));
@@ -67,8 +67,8 @@
expect(platformGoogleMap.markersToChange.isEmpty, true);
});
- testWidgets("Removing a marker", (WidgetTester tester) async {
- final Marker m1 = Marker(markerId: MarkerId("marker_1"));
+ testWidgets('Removing a marker', (WidgetTester tester) async {
+ const Marker m1 = Marker(markerId: MarkerId('marker_1'));
await tester.pumpWidget(_mapWithMarkers(<Marker>{m1}));
await tester.pumpWidget(_mapWithMarkers(<Marker>{}));
@@ -82,9 +82,9 @@
expect(platformGoogleMap.markersToAdd.isEmpty, true);
});
- testWidgets("Updating a marker", (WidgetTester tester) async {
- final Marker m1 = Marker(markerId: MarkerId("marker_1"));
- final Marker m2 = Marker(markerId: MarkerId("marker_1"), alpha: 0.5);
+ testWidgets('Updating a marker', (WidgetTester tester) async {
+ const Marker m1 = Marker(markerId: MarkerId('marker_1'));
+ const Marker m2 = Marker(markerId: MarkerId('marker_1'), alpha: 0.5);
await tester.pumpWidget(_mapWithMarkers(<Marker>{m1}));
await tester.pumpWidget(_mapWithMarkers(<Marker>{m2}));
@@ -98,11 +98,11 @@
expect(platformGoogleMap.markersToAdd.isEmpty, true);
});
- testWidgets("Updating a marker", (WidgetTester tester) async {
- final Marker m1 = Marker(markerId: MarkerId("marker_1"));
- final Marker m2 = Marker(
- markerId: MarkerId("marker_1"),
- infoWindow: const InfoWindow(snippet: 'changed'),
+ testWidgets('Updating a marker', (WidgetTester tester) async {
+ const Marker m1 = Marker(markerId: MarkerId('marker_1'));
+ const Marker m2 = Marker(
+ markerId: MarkerId('marker_1'),
+ infoWindow: InfoWindow(snippet: 'changed'),
);
await tester.pumpWidget(_mapWithMarkers(<Marker>{m1}));
@@ -117,12 +117,12 @@
expect(update.infoWindow.snippet, 'changed');
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Marker m1 = Marker(markerId: MarkerId("marker_1"));
- Marker m2 = Marker(markerId: MarkerId("marker_2"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Marker m1 = const Marker(markerId: MarkerId('marker_1'));
+ Marker m2 = const Marker(markerId: MarkerId('marker_2'));
final Set<Marker> prev = <Marker>{m1, m2};
- m1 = Marker(markerId: MarkerId("marker_1"), visible: false);
- m2 = Marker(markerId: MarkerId("marker_2"), draggable: true);
+ m1 = const Marker(markerId: MarkerId('marker_1'), visible: false);
+ m2 = const Marker(markerId: MarkerId('marker_2'), draggable: true);
final Set<Marker> cur = <Marker>{m1, m2};
await tester.pumpWidget(_mapWithMarkers(prev));
@@ -136,14 +136,14 @@
expect(platformGoogleMap.markersToAdd.isEmpty, true);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Marker m2 = Marker(markerId: MarkerId("marker_2"));
- final Marker m3 = Marker(markerId: MarkerId("marker_3"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Marker m2 = const Marker(markerId: MarkerId('marker_2'));
+ const Marker m3 = Marker(markerId: MarkerId('marker_3'));
final Set<Marker> prev = <Marker>{m2, m3};
// m1 is added, m2 is updated, m3 is removed.
- final Marker m1 = Marker(markerId: MarkerId("marker_1"));
- m2 = Marker(markerId: MarkerId("marker_2"), draggable: true);
+ const Marker m1 = Marker(markerId: MarkerId('marker_1'));
+ m2 = const Marker(markerId: MarkerId('marker_2'), draggable: true);
final Set<Marker> cur = <Marker>{m1, m2};
await tester.pumpWidget(_mapWithMarkers(prev));
@@ -161,12 +161,12 @@
expect(platformGoogleMap.markerIdsToRemove.first, equals(m3.markerId));
});
- testWidgets("Partial Update", (WidgetTester tester) async {
- final Marker m1 = Marker(markerId: MarkerId("marker_1"));
- final Marker m2 = Marker(markerId: MarkerId("marker_2"));
- Marker m3 = Marker(markerId: MarkerId("marker_3"));
+ testWidgets('Partial Update', (WidgetTester tester) async {
+ const Marker m1 = Marker(markerId: MarkerId('marker_1'));
+ const Marker m2 = Marker(markerId: MarkerId('marker_2'));
+ Marker m3 = const Marker(markerId: MarkerId('marker_3'));
final Set<Marker> prev = <Marker>{m1, m2, m3};
- m3 = Marker(markerId: MarkerId("marker_3"), draggable: true);
+ m3 = const Marker(markerId: MarkerId('marker_3'), draggable: true);
final Set<Marker> cur = <Marker>{m1, m2, m3};
await tester.pumpWidget(_mapWithMarkers(prev));
@@ -180,12 +180,12 @@
expect(platformGoogleMap.markersToAdd.isEmpty, true);
});
- testWidgets("Update non platform related attr", (WidgetTester tester) async {
- Marker m1 = Marker(markerId: MarkerId("marker_1"));
+ testWidgets('Update non platform related attr', (WidgetTester tester) async {
+ Marker m1 = const Marker(markerId: MarkerId('marker_1'));
final Set<Marker> prev = <Marker>{m1};
m1 = Marker(
- markerId: MarkerId("marker_1"),
- onTap: () => print("hello"),
+ markerId: const MarkerId('marker_1'),
+ onTap: () => print('hello'),
onDragEnd: (LatLng latLng) => print(latLng));
final Set<Marker> cur = <Marker>{m1};
diff --git a/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart
index 79c63c1..cb7263c 100644
--- a/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart
@@ -23,9 +23,9 @@
required double size,
LatLng center = const LatLng(0, 0),
}) {
- final halfSize = size / 2;
+ final double halfSize = size / 2;
- return [
+ return <LatLng>[
LatLng(center.latitude + halfSize, center.longitude + halfSize),
LatLng(center.latitude - halfSize, center.longitude + halfSize),
LatLng(center.latitude - halfSize, center.longitude - halfSize),
@@ -38,7 +38,7 @@
return Polygon(
polygonId: polygonId,
points: _rectPoints(size: 1),
- holes: [_rectPoints(size: 0.5)],
+ holes: <List<LatLng>>[_rectPoints(size: 0.5)],
);
}
@@ -58,7 +58,7 @@
});
testWidgets('Initializing a polygon', (WidgetTester tester) async {
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
final FakePlatformGoogleMap platformGoogleMap =
@@ -71,9 +71,9 @@
expect(platformGoogleMap.polygonsToChange.isEmpty, true);
});
- testWidgets("Adding a polygon", (WidgetTester tester) async {
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- final Polygon p2 = Polygon(polygonId: PolygonId("polygon_2"));
+ testWidgets('Adding a polygon', (WidgetTester tester) async {
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
+ const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2'));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1, p2}));
@@ -90,8 +90,8 @@
expect(platformGoogleMap.polygonsToChange.isEmpty, true);
});
- testWidgets("Removing a polygon", (WidgetTester tester) async {
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
+ testWidgets('Removing a polygon', (WidgetTester tester) async {
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{}));
@@ -105,10 +105,10 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Updating a polygon", (WidgetTester tester) async {
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- final Polygon p2 =
- Polygon(polygonId: PolygonId("polygon_1"), geodesic: true);
+ testWidgets('Updating a polygon', (WidgetTester tester) async {
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
+ const Polygon p2 =
+ Polygon(polygonId: PolygonId('polygon_1'), geodesic: true);
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p2}));
@@ -122,10 +122,11 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Mutate a polygon", (WidgetTester tester) async {
+ testWidgets('Mutate a polygon', (WidgetTester tester) async {
+ final List<LatLng> _points = <LatLng>[const LatLng(0.0, 0.0)];
final Polygon p1 = Polygon(
- polygonId: PolygonId("polygon_1"),
- points: <LatLng>[const LatLng(0.0, 0.0)],
+ polygonId: const PolygonId('polygon_1'),
+ points: _points,
);
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
@@ -141,12 +142,12 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- Polygon p2 = Polygon(polygonId: PolygonId("polygon_2"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Polygon p1 = const Polygon(polygonId: PolygonId('polygon_1'));
+ Polygon p2 = const Polygon(polygonId: PolygonId('polygon_2'));
final Set<Polygon> prev = <Polygon>{p1, p2};
- p1 = Polygon(polygonId: PolygonId("polygon_1"), visible: false);
- p2 = Polygon(polygonId: PolygonId("polygon_2"), geodesic: true);
+ p1 = const Polygon(polygonId: PolygonId('polygon_1'), visible: false);
+ p2 = const Polygon(polygonId: PolygonId('polygon_2'), geodesic: true);
final Set<Polygon> cur = <Polygon>{p1, p2};
await tester.pumpWidget(_mapWithPolygons(prev));
@@ -160,14 +161,14 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Polygon p2 = Polygon(polygonId: PolygonId("polygon_2"));
- final Polygon p3 = Polygon(polygonId: PolygonId("polygon_3"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Polygon p2 = const Polygon(polygonId: PolygonId('polygon_2'));
+ const Polygon p3 = Polygon(polygonId: PolygonId('polygon_3'));
final Set<Polygon> prev = <Polygon>{p2, p3};
// p1 is added, p2 is updated, p3 is removed.
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- p2 = Polygon(polygonId: PolygonId("polygon_2"), geodesic: true);
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
+ p2 = const Polygon(polygonId: PolygonId('polygon_2'), geodesic: true);
final Set<Polygon> cur = <Polygon>{p1, p2};
await tester.pumpWidget(_mapWithPolygons(prev));
@@ -185,12 +186,12 @@
expect(platformGoogleMap.polygonIdsToRemove.first, equals(p3.polygonId));
});
- testWidgets("Partial Update", (WidgetTester tester) async {
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- final Polygon p2 = Polygon(polygonId: PolygonId("polygon_2"));
- Polygon p3 = Polygon(polygonId: PolygonId("polygon_3"));
+ testWidgets('Partial Update', (WidgetTester tester) async {
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
+ const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2'));
+ Polygon p3 = const Polygon(polygonId: PolygonId('polygon_3'));
final Set<Polygon> prev = <Polygon>{p1, p2, p3};
- p3 = Polygon(polygonId: PolygonId("polygon_3"), geodesic: true);
+ p3 = const Polygon(polygonId: PolygonId('polygon_3'), geodesic: true);
final Set<Polygon> cur = <Polygon>{p1, p2, p3};
await tester.pumpWidget(_mapWithPolygons(prev));
@@ -204,10 +205,11 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Update non platform related attr", (WidgetTester tester) async {
- Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
+ testWidgets('Update non platform related attr', (WidgetTester tester) async {
+ Polygon p1 = const Polygon(polygonId: PolygonId('polygon_1'));
final Set<Polygon> prev = <Polygon>{p1};
- p1 = Polygon(polygonId: PolygonId("polygon_1"), onTap: () => print(2 + 2));
+ p1 = Polygon(
+ polygonId: const PolygonId('polygon_1'), onTap: () => print(2 + 2));
final Set<Polygon> cur = <Polygon>{p1};
await tester.pumpWidget(_mapWithPolygons(prev));
@@ -223,7 +225,7 @@
testWidgets('Initializing a polygon with points and hole',
(WidgetTester tester) async {
- final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1"));
+ final Polygon p1 = _polygonWithPointsAndHole(const PolygonId('polygon_1'));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
final FakePlatformGoogleMap platformGoogleMap =
@@ -236,10 +238,10 @@
expect(platformGoogleMap.polygonsToChange.isEmpty, true);
});
- testWidgets("Adding a polygon with points and hole",
+ testWidgets('Adding a polygon with points and hole',
(WidgetTester tester) async {
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- final Polygon p2 = _polygonWithPointsAndHole(PolygonId("polygon_2"));
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
+ final Polygon p2 = _polygonWithPointsAndHole(const PolygonId('polygon_2'));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1, p2}));
@@ -256,9 +258,9 @@
expect(platformGoogleMap.polygonsToChange.isEmpty, true);
});
- testWidgets("Removing a polygon with points and hole",
+ testWidgets('Removing a polygon with points and hole',
(WidgetTester tester) async {
- final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1"));
+ final Polygon p1 = _polygonWithPointsAndHole(const PolygonId('polygon_1'));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{}));
@@ -272,10 +274,10 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Updating a polygon by adding points and hole",
+ testWidgets('Updating a polygon by adding points and hole',
(WidgetTester tester) async {
- final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- final Polygon p2 = _polygonWithPointsAndHole(PolygonId("polygon_1"));
+ const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1'));
+ final Polygon p2 = _polygonWithPointsAndHole(const PolygonId('polygon_1'));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p2}));
@@ -289,12 +291,12 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Mutate a polygon with points and holes",
+ testWidgets('Mutate a polygon with points and holes',
(WidgetTester tester) async {
final Polygon p1 = Polygon(
- polygonId: PolygonId("polygon_1"),
+ polygonId: const PolygonId('polygon_1'),
points: _rectPoints(size: 1),
- holes: [_rectPoints(size: 0.5)],
+ holes: <List<LatLng>>[_rectPoints(size: 0.5)],
);
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
@@ -303,7 +305,7 @@
..addAll(_rectPoints(size: 2));
p1.holes
..clear()
- ..addAll([_rectPoints(size: 1)]);
+ ..addAll(<List<LatLng>>[_rectPoints(size: 1)]);
await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));
final FakePlatformGoogleMap platformGoogleMap =
@@ -315,19 +317,19 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Multi Update polygons with points and hole",
+ testWidgets('Multi Update polygons with points and hole',
(WidgetTester tester) async {
- Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
+ Polygon p1 = const Polygon(polygonId: PolygonId('polygon_1'));
Polygon p2 = Polygon(
- polygonId: PolygonId("polygon_2"),
+ polygonId: const PolygonId('polygon_2'),
points: _rectPoints(size: 2),
- holes: [_rectPoints(size: 1)],
+ holes: <List<LatLng>>[_rectPoints(size: 1)],
);
final Set<Polygon> prev = <Polygon>{p1, p2};
- p1 = Polygon(polygonId: PolygonId("polygon_1"), visible: false);
+ p1 = const Polygon(polygonId: PolygonId('polygon_1'), visible: false);
p2 = p2.copyWith(
pointsParam: _rectPoints(size: 5),
- holesParam: [_rectPoints(size: 2)],
+ holesParam: <List<LatLng>>[_rectPoints(size: 2)],
);
final Set<Polygon> cur = <Polygon>{p1, p2};
@@ -342,21 +344,21 @@
expect(platformGoogleMap.polygonsToAdd.isEmpty, true);
});
- testWidgets("Multi Update polygons with points and hole",
+ testWidgets('Multi Update polygons with points and hole',
(WidgetTester tester) async {
Polygon p2 = Polygon(
- polygonId: PolygonId("polygon_2"),
+ polygonId: const PolygonId('polygon_2'),
points: _rectPoints(size: 2),
- holes: [_rectPoints(size: 1)],
+ holes: <List<LatLng>>[_rectPoints(size: 1)],
);
- final Polygon p3 = Polygon(polygonId: PolygonId("polygon_3"));
+ const Polygon p3 = Polygon(polygonId: PolygonId('polygon_3'));
final Set<Polygon> prev = <Polygon>{p2, p3};
// p1 is added, p2 is updated, p3 is removed.
- final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1"));
+ final Polygon p1 = _polygonWithPointsAndHole(const PolygonId('polygon_1'));
p2 = p2.copyWith(
pointsParam: _rectPoints(size: 5),
- holesParam: [_rectPoints(size: 3)],
+ holesParam: <List<LatLng>>[_rectPoints(size: 3)],
);
final Set<Polygon> cur = <Polygon>{p1, p2};
@@ -375,19 +377,19 @@
expect(platformGoogleMap.polygonIdsToRemove.first, equals(p3.polygonId));
});
- testWidgets("Partial Update polygons with points and hole",
+ testWidgets('Partial Update polygons with points and hole',
(WidgetTester tester) async {
- final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1"));
- final Polygon p2 = Polygon(polygonId: PolygonId("polygon_2"));
+ final Polygon p1 = _polygonWithPointsAndHole(const PolygonId('polygon_1'));
+ const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2'));
Polygon p3 = Polygon(
- polygonId: PolygonId("polygon_3"),
+ polygonId: const PolygonId('polygon_3'),
points: _rectPoints(size: 2),
- holes: [_rectPoints(size: 1)],
+ holes: <List<LatLng>>[_rectPoints(size: 1)],
);
final Set<Polygon> prev = <Polygon>{p1, p2, p3};
p3 = p3.copyWith(
pointsParam: _rectPoints(size: 5),
- holesParam: [_rectPoints(size: 3)],
+ holesParam: <List<LatLng>>[_rectPoints(size: 3)],
);
final Set<Polygon> cur = <Polygon>{p1, p2, p3};
diff --git a/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart
index 01eb2e2..9cbba3a 100644
--- a/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart
@@ -35,7 +35,7 @@
});
testWidgets('Initializing a polyline', (WidgetTester tester) async {
- final Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
+ const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1'));
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p1}));
final FakePlatformGoogleMap platformGoogleMap =
@@ -48,9 +48,9 @@
expect(platformGoogleMap.polylinesToChange.isEmpty, true);
});
- testWidgets("Adding a polyline", (WidgetTester tester) async {
- final Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
- final Polyline p2 = Polyline(polylineId: PolylineId("polyline_2"));
+ testWidgets('Adding a polyline', (WidgetTester tester) async {
+ const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1'));
+ const Polyline p2 = Polyline(polylineId: PolylineId('polyline_2'));
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p1}));
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p1, p2}));
@@ -67,8 +67,8 @@
expect(platformGoogleMap.polylinesToChange.isEmpty, true);
});
- testWidgets("Removing a polyline", (WidgetTester tester) async {
- final Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
+ testWidgets('Removing a polyline', (WidgetTester tester) async {
+ const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1'));
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p1}));
await tester.pumpWidget(_mapWithPolylines(<Polyline>{}));
@@ -82,10 +82,10 @@
expect(platformGoogleMap.polylinesToAdd.isEmpty, true);
});
- testWidgets("Updating a polyline", (WidgetTester tester) async {
- final Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
- final Polyline p2 =
- Polyline(polylineId: PolylineId("polyline_1"), geodesic: true);
+ testWidgets('Updating a polyline', (WidgetTester tester) async {
+ const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1'));
+ const Polyline p2 =
+ Polyline(polylineId: PolylineId('polyline_1'), geodesic: true);
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p1}));
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p2}));
@@ -99,10 +99,10 @@
expect(platformGoogleMap.polylinesToAdd.isEmpty, true);
});
- testWidgets("Updating a polyline", (WidgetTester tester) async {
- final Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
- final Polyline p2 =
- Polyline(polylineId: PolylineId("polyline_1"), geodesic: true);
+ testWidgets('Updating a polyline', (WidgetTester tester) async {
+ const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1'));
+ const Polyline p2 =
+ Polyline(polylineId: PolylineId('polyline_1'), geodesic: true);
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p1}));
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p2}));
@@ -116,10 +116,11 @@
expect(update.geodesic, true);
});
- testWidgets("Mutate a polyline", (WidgetTester tester) async {
+ testWidgets('Mutate a polyline', (WidgetTester tester) async {
+ final List<LatLng> _points = <LatLng>[const LatLng(0.0, 0.0)];
final Polyline p1 = Polyline(
- polylineId: PolylineId("polyline_1"),
- points: <LatLng>[const LatLng(0.0, 0.0)],
+ polylineId: const PolylineId('polyline_1'),
+ points: _points,
);
await tester.pumpWidget(_mapWithPolylines(<Polyline>{p1}));
@@ -135,12 +136,12 @@
expect(platformGoogleMap.polylinesToAdd.isEmpty, true);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
- Polyline p2 = Polyline(polylineId: PolylineId("polyline_2"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Polyline p1 = const Polyline(polylineId: PolylineId('polyline_1'));
+ Polyline p2 = const Polyline(polylineId: PolylineId('polyline_2'));
final Set<Polyline> prev = <Polyline>{p1, p2};
- p1 = Polyline(polylineId: PolylineId("polyline_1"), visible: false);
- p2 = Polyline(polylineId: PolylineId("polyline_2"), geodesic: true);
+ p1 = const Polyline(polylineId: PolylineId('polyline_1'), visible: false);
+ p2 = const Polyline(polylineId: PolylineId('polyline_2'), geodesic: true);
final Set<Polyline> cur = <Polyline>{p1, p2};
await tester.pumpWidget(_mapWithPolylines(prev));
@@ -154,14 +155,14 @@
expect(platformGoogleMap.polylinesToAdd.isEmpty, true);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
- Polyline p2 = Polyline(polylineId: PolylineId("polyline_2"));
- final Polyline p3 = Polyline(polylineId: PolylineId("polyline_3"));
+ testWidgets('Multi Update', (WidgetTester tester) async {
+ Polyline p2 = const Polyline(polylineId: PolylineId('polyline_2'));
+ const Polyline p3 = Polyline(polylineId: PolylineId('polyline_3'));
final Set<Polyline> prev = <Polyline>{p2, p3};
// p1 is added, p2 is updated, p3 is removed.
- final Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
- p2 = Polyline(polylineId: PolylineId("polyline_2"), geodesic: true);
+ const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1'));
+ p2 = const Polyline(polylineId: PolylineId('polyline_2'), geodesic: true);
final Set<Polyline> cur = <Polyline>{p1, p2};
await tester.pumpWidget(_mapWithPolylines(prev));
@@ -179,12 +180,12 @@
expect(platformGoogleMap.polylineIdsToRemove.first, equals(p3.polylineId));
});
- testWidgets("Partial Update", (WidgetTester tester) async {
- final Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"));
- final Polyline p2 = Polyline(polylineId: PolylineId("polyline_2"));
- Polyline p3 = Polyline(polylineId: PolylineId("polyline_3"));
+ testWidgets('Partial Update', (WidgetTester tester) async {
+ const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1'));
+ const Polyline p2 = Polyline(polylineId: PolylineId('polyline_2'));
+ Polyline p3 = const Polyline(polylineId: PolylineId('polyline_3'));
final Set<Polyline> prev = <Polyline>{p1, p2, p3};
- p3 = Polyline(polylineId: PolylineId("polyline_3"), geodesic: true);
+ p3 = const Polyline(polylineId: PolylineId('polyline_3'), geodesic: true);
final Set<Polyline> cur = <Polyline>{p1, p2, p3};
await tester.pumpWidget(_mapWithPolylines(prev));
@@ -198,11 +199,12 @@
expect(platformGoogleMap.polylinesToAdd.isEmpty, true);
});
- testWidgets("Update non platform related attr", (WidgetTester tester) async {
- Polyline p1 = Polyline(polylineId: PolylineId("polyline_1"), onTap: null);
+ testWidgets('Update non platform related attr', (WidgetTester tester) async {
+ Polyline p1 =
+ const Polyline(polylineId: PolylineId('polyline_1'), onTap: null);
final Set<Polyline> prev = <Polyline>{p1};
p1 = Polyline(
- polylineId: PolylineId("polyline_1"), onTap: () => print(2 + 2));
+ polylineId: const PolylineId('polyline_1'), onTap: () => print(2 + 2));
final Set<Polyline> cur = <Polyline>{p1};
await tester.pumpWidget(_mapWithPolylines(prev));
diff --git a/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart
index 35732da..b4586f7 100644
--- a/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart
@@ -33,8 +33,8 @@
});
testWidgets('Initializing a tile overlay', (WidgetTester tester) async {
- final TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
+ const TileOverlay t1 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t1}));
final FakePlatformGoogleMap platformGoogleMap =
@@ -48,11 +48,11 @@
expect(platformGoogleMap.tileOverlaysToChange.isEmpty, true);
});
- testWidgets("Adding a tile overlay", (WidgetTester tester) async {
- final TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
- final TileOverlay t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_2"));
+ testWidgets('Adding a tile overlay', (WidgetTester tester) async {
+ const TileOverlay t1 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
+ const TileOverlay t2 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_2'));
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t1}));
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t1, t2}));
@@ -69,9 +69,9 @@
expect(platformGoogleMap.tileOverlaysToChange.isEmpty, true);
});
- testWidgets("Removing a tile overlay", (WidgetTester tester) async {
- final TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
+ testWidgets('Removing a tile overlay', (WidgetTester tester) async {
+ const TileOverlay t1 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t1}));
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{}));
@@ -86,11 +86,11 @@
expect(platformGoogleMap.tileOverlaysToAdd.isEmpty, true);
});
- testWidgets("Updating a tile overlay", (WidgetTester tester) async {
- final TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
- final TileOverlay t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"), zIndex: 10);
+ testWidgets('Updating a tile overlay', (WidgetTester tester) async {
+ const TileOverlay t1 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
+ const TileOverlay t2 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'), zIndex: 10);
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t1}));
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t2}));
@@ -104,11 +104,11 @@
expect(platformGoogleMap.tileOverlaysToAdd.isEmpty, true);
});
- testWidgets("Updating a tile overlay", (WidgetTester tester) async {
- final TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
- final TileOverlay t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"), zIndex: 10);
+ testWidgets('Updating a tile overlay', (WidgetTester tester) async {
+ const TileOverlay t1 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
+ const TileOverlay t2 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'), zIndex: 10);
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t1}));
await tester.pumpWidget(_mapWithTileOverlays(<TileOverlay>{t2}));
@@ -122,16 +122,16 @@
expect(update.zIndex, 10);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
+ testWidgets('Multi Update', (WidgetTester tester) async {
TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
+ const TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
TileOverlay t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_2"));
+ const TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_2'));
final Set<TileOverlay> prev = <TileOverlay>{t1, t2};
- t1 = TileOverlay(
- tileOverlayId: TileOverlayId("tile_overlay_1"), visible: false);
- t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_2"), zIndex: 10);
+ t1 = const TileOverlay(
+ tileOverlayId: TileOverlayId('tile_overlay_1'), visible: false);
+ t2 = const TileOverlay(
+ tileOverlayId: TileOverlayId('tile_overlay_2'), zIndex: 10);
final Set<TileOverlay> cur = <TileOverlay>{t1, t2};
await tester.pumpWidget(_mapWithTileOverlays(prev));
@@ -145,18 +145,18 @@
expect(platformGoogleMap.tileOverlaysToAdd.isEmpty, true);
});
- testWidgets("Multi Update", (WidgetTester tester) async {
+ testWidgets('Multi Update', (WidgetTester tester) async {
TileOverlay t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_2"));
- final TileOverlay t3 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_3"));
+ const TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_2'));
+ const TileOverlay t3 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_3'));
final Set<TileOverlay> prev = <TileOverlay>{t2, t3};
// t1 is added, t2 is updated, t3 is removed.
- final TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
- t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_2"), zIndex: 10);
+ const TileOverlay t1 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
+ t2 = const TileOverlay(
+ tileOverlayId: TileOverlayId('tile_overlay_2'), zIndex: 10);
final Set<TileOverlay> cur = <TileOverlay>{t1, t2};
await tester.pumpWidget(_mapWithTileOverlays(prev));
@@ -175,16 +175,16 @@
equals(t3.tileOverlayId));
});
- testWidgets("Partial Update", (WidgetTester tester) async {
- final TileOverlay t1 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_1"));
- final TileOverlay t2 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_2"));
+ testWidgets('Partial Update', (WidgetTester tester) async {
+ const TileOverlay t1 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_1'));
+ const TileOverlay t2 =
+ TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_2'));
TileOverlay t3 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_3"));
+ const TileOverlay(tileOverlayId: TileOverlayId('tile_overlay_3'));
final Set<TileOverlay> prev = <TileOverlay>{t1, t2, t3};
- t3 =
- TileOverlay(tileOverlayId: TileOverlayId("tile_overlay_3"), zIndex: 10);
+ t3 = const TileOverlay(
+ tileOverlayId: TileOverlayId('tile_overlay_3'), zIndex: 10);
final Set<TileOverlay> cur = <TileOverlay>{t1, t2, t3};
await tester.pumpWidget(_mapWithTileOverlays(prev));
diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml
index 89d061f..e08024c 100644
--- a/script/configs/custom_analysis.yaml
+++ b/script/configs/custom_analysis.yaml
@@ -11,7 +11,6 @@
# TODO(ecosystem): Remove everything from this list. See:
# https://github.com/flutter/flutter/issues/76229
-- google_maps_flutter/google_maps_flutter
- google_maps_flutter/google_maps_flutter_platform_interface
- google_maps_flutter/google_maps_flutter_web
- in_app_purchase/in_app_purchase