Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit d7125cd

Browse files
authored
[google_maps_flutter_platform_interface] Mark constructors as const for ids (#3718)
1 parent 3222a3e commit d7125cd

File tree

17 files changed

+111
-101
lines changed

17 files changed

+111
-101
lines changed

packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.2
2+
3+
* Mark constructors for CameraUpdate, CircleId, MapsObjectId, MarkerId, PolygonId, PolylineId and TileOverlayId as const
4+
15
## 2.0.1
26

37
* Update platform_plugin_interface version requirement.

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
import 'dart:async';
66
import 'dart:typed_data';
77

8-
import 'package:flutter/material.dart';
98
import 'package:flutter/foundation.dart';
10-
import 'package:flutter/services.dart';
119
import 'package:flutter/gestures.dart';
12-
10+
import 'package:flutter/material.dart';
11+
import 'package:flutter/services.dart';
1312
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
1413
import 'package:stream_transform/stream_transform.dart';
14+
1515
import '../types/tile_overlay_updates.dart';
1616
import '../types/utils/tile_overlay.dart';
1717

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/camera.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class CameraPosition {
109109
/// Defines a camera move, supporting absolute moves as well as moves relative
110110
/// the current position.
111111
class CameraUpdate {
112-
CameraUpdate._(this._json);
112+
const CameraUpdate._(this._json);
113113

114114
/// Returns a camera update that moves the camera to the specified position.
115115
static CameraUpdate newCameraPosition(CameraPosition cameraPosition) {
@@ -176,15 +176,15 @@ class CameraUpdate {
176176
///
177177
/// Equivalent to the result of calling `zoomBy(1.0)`.
178178
static CameraUpdate zoomIn() {
179-
return CameraUpdate._(<Object>['zoomIn']);
179+
return const CameraUpdate._(<Object>['zoomIn']);
180180
}
181181

182182
/// Returns a camera update that zooms the camera out, bringing the camera
183183
/// further away from the surface of the Earth.
184184
///
185185
/// Equivalent to the result of calling `zoomBy(-1.0)`.
186186
static CameraUpdate zoomOut() {
187-
return CameraUpdate._(<Object>['zoomOut']);
187+
return const CameraUpdate._(<Object>['zoomOut']);
188188
}
189189

190190
/// Returns a camera update that sets the camera zoom level.

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'types.dart';
1414
@immutable
1515
class CircleId extends MapsObjectId<Circle> {
1616
/// Creates an immutable identifier for a [Circle].
17-
CircleId(String value) : super(value);
17+
const CircleId(String value) : super(value);
1818
}
1919

2020
/// Draws a circle on the map.

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MapsObjectId<T> {
1414
/// Creates an immutable object representing a [T] among [GoogleMap] Ts.
1515
///
1616
/// An [AssertionError] will be thrown if [value] is null.
17-
MapsObjectId(this.value) : assert(value != null);
17+
const MapsObjectId(this.value) : assert(value != null);
1818

1919
/// The value of the id.
2020
final String value;

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/marker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class InfoWindow {
104104
@immutable
105105
class MarkerId extends MapsObjectId<Marker> {
106106
/// Creates an immutable identifier for a [Marker].
107-
MarkerId(String value) : super(value);
107+
const MarkerId(String value) : super(value);
108108
}
109109

110110
/// Marks a geographical location on the map.

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'types.dart';
1515
@immutable
1616
class PolygonId extends MapsObjectId<Polygon> {
1717
/// Creates an immutable identifier for a [Polygon].
18-
PolygonId(String value) : super(value);
18+
const PolygonId(String value) : super(value);
1919
}
2020

2121
/// Draws a polygon through geographical locations on the map.
@@ -167,7 +167,7 @@ class Polygon implements MapsObject {
167167
fillColor == typedOther.fillColor &&
168168
geodesic == typedOther.geodesic &&
169169
listEquals(points, typedOther.points) &&
170-
DeepCollectionEquality().equals(holes, typedOther.holes) &&
170+
const DeepCollectionEquality().equals(holes, typedOther.holes) &&
171171
visible == typedOther.visible &&
172172
strokeColor == typedOther.strokeColor &&
173173
strokeWidth == typedOther.strokeWidth &&

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class PolylineId extends MapsObjectId<Polyline> {
1616
/// Creates an immutable object representing a [PolylineId] among [GoogleMap] polylines.
1717
///
1818
/// An [AssertionError] will be thrown if [value] is null.
19-
PolylineId(String value) : super(value);
19+
const PolylineId(String value) : super(value);
2020
}
2121

2222
/// Draws a line through geographical locations on the map.

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile_overlay.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
// found in the LICENSE file.
44

55
import 'dart:ui' show hashValues;
6+
67
import 'package:flutter/foundation.dart';
8+
import 'package:meta/meta.dart' show immutable;
79

810
import 'types.dart';
9-
import 'package:meta/meta.dart' show immutable;
1011

1112
/// Uniquely identifies a [TileOverlay] among [GoogleMap] tile overlays.
1213
@immutable
1314
class TileOverlayId extends MapsObjectId<TileOverlay> {
1415
/// Creates an immutable identifier for a [TileOverlay].
15-
TileOverlayId(String value) : super(value);
16+
const TileOverlayId(String value) : super(value);
1617
}
1718

1819
/// A set of images which are displayed on top of the base map tiles.

packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the google_maps_flutter plugin.
33
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 2.0.1
6+
version: 2.0.2
77

88
dependencies:
99
flutter:

0 commit comments

Comments
 (0)