Skip to content

Commit 48da591

Browse files
stuartmorgan-gandroidseb
authored andcommitted
[google_maps_flutter] Annotate deprecated member usage (flutter#8214)
There are several intentional uses of deprecated members from other packages within the plugin group, so annotate them so that they don't show up in the regular team audits: - App-facing package integration tests of the deprecated style method. - Handling of deprecated marker bitmap formats. These turned up in the [routine repo audit](https://github.com/flutter/flutter/blob/main/docs/infra/Packages-Gardener-Rotation.md#deprecations).
1 parent 748b0ed commit 48da591

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed

packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_controller.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ void runTests() {
162162

163163
const String mapStyle =
164164
'[{"elementType":"geometry","stylers":[{"color":"#242f3e"}]}]';
165+
// Intentionally testing the deprecated code path.
166+
// ignore: deprecated_member_use
165167
await controller.setMapStyle(mapStyle);
166168
});
167169

@@ -184,6 +186,8 @@ void runTests() {
184186
final GoogleMapController controller = await controllerCompleter.future;
185187

186188
try {
189+
// Intentionally testing the deprecated code path.
190+
// ignore: deprecated_member_use
187191
await controller.setMapStyle('invalid_value');
188192
fail('expected MapStyleException');
189193
} on MapStyleException catch (e) {
@@ -208,6 +212,8 @@ void runTests() {
208212
);
209213
final GoogleMapController controller = await controllerCompleter.future;
210214

215+
// Intentionally testing the deprecated code path.
216+
// ignore: deprecated_member_use
211217
await controller.setMapStyle(null);
212218
});
213219

@@ -471,6 +477,8 @@ void runTests() {
471477
final Set<Marker> markers = <Marker>{
472478
Marker(
473479
markerId: const MarkerId('1'),
480+
// Intentionally testing the deprecated code path.
481+
// ignore: deprecated_member_use
474482
icon: await BitmapDescriptor.fromAssetImage(
475483
imageConfiguration,
476484
'assets/red_square.png',
@@ -493,6 +501,8 @@ void runTests() {
493501
final Set<Marker> markers = <Marker>{
494502
Marker(
495503
markerId: const MarkerId('1'),
504+
// Intentionally testing the deprecated code path.
505+
// ignore: deprecated_member_use
496506
icon: BitmapDescriptor.fromBytes(
497507
bytes,
498508
size: const Size(100, 100),

packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,8 @@ void googleMapsTests() {
14051405
final Set<Marker> markers = <Marker>{
14061406
Marker(
14071407
markerId: const MarkerId('1'),
1408+
// Intentionally testing the deprecated code path.
1409+
// ignore: deprecated_member_use
14081410
icon: await BitmapDescriptor.fromAssetImage(
14091411
imageConfiguration,
14101412
'assets/red_square.png',
@@ -1427,6 +1429,8 @@ void googleMapsTests() {
14271429
final Set<Marker> markers = <Marker>{
14281430
Marker(
14291431
markerId: const MarkerId('1'),
1432+
// Intentionally testing the deprecated code path.
1433+
// ignore: deprecated_member_use
14301434
icon: BitmapDescriptor.fromBytes(
14311435
bytes,
14321436
size: const Size(100, 100),

packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
885885
case final DefaultMarker marker:
886886
return PlatformBitmap(
887887
bitmap: PlatformBitmapDefaultMarker(hue: marker.hue?.toDouble()));
888+
// Clients may still use this deprecated format, so it must be supported.
889+
// ignore: deprecated_member_use
888890
case final BytesBitmap bytes:
889891
return PlatformBitmap(
890892
bitmap: PlatformBitmapBytes(
@@ -895,6 +897,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
895897
case final AssetBitmap asset:
896898
return PlatformBitmap(
897899
bitmap: PlatformBitmapAsset(name: asset.name, pkg: asset.package));
900+
// Clients may still use this deprecated format, so it must be supported.
901+
// ignore: deprecated_member_use
898902
case final AssetImageBitmap asset:
899903
return PlatformBitmap(
900904
bitmap: PlatformBitmapAssetImage(

packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,8 @@ void main() {
12451245
final Set<Marker> markers = <Marker>{
12461246
Marker(
12471247
markerId: const MarkerId('1'),
1248+
// Intentionally testing the deprecated code path.
1249+
// ignore: deprecated_member_use
12481250
icon: await BitmapDescriptor.fromAssetImage(
12491251
imageConfiguration,
12501252
'assets/red_square.png',
@@ -1268,6 +1270,8 @@ void main() {
12681270
testWidgets('markerWithLegacyBytes', (WidgetTester tester) async {
12691271
tester.view.devicePixelRatio = 2.0;
12701272
final Uint8List bytes = const Base64Decoder().convert(iconImageBase64);
1273+
// Intentionally testing the deprecated code path.
1274+
// ignore: deprecated_member_use
12711275
final BitmapDescriptor icon = BitmapDescriptor.fromBytes(
12721276
bytes,
12731277
);

packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,8 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform {
773773
case final DefaultMarker marker:
774774
return PlatformBitmap(
775775
bitmap: PlatformBitmapDefaultMarker(hue: marker.hue?.toDouble()));
776+
// Clients may still use this deprecated format, so it must be supported.
777+
// ignore: deprecated_member_use
776778
case final BytesBitmap bytes:
777779
final Size? size = bytes.size;
778780
return PlatformBitmap(
@@ -782,6 +784,8 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform {
782784
case final AssetBitmap asset:
783785
return PlatformBitmap(
784786
bitmap: PlatformBitmapAsset(name: asset.name, pkg: asset.package));
787+
// Clients may still use this deprecated format, so it must be supported.
788+
// ignore: deprecated_member_use
785789
case final AssetImageBitmap asset:
786790
final Size? size = asset.size;
787791
return PlatformBitmap(

packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_controller.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,10 @@ class GoogleMapController {
194194
/// own configuration and are rendered on top of a GMap instance later. This
195195
/// happens in the second half of this method.
196196
///
197-
/// This method is eagerly called from the [GoogleMapsPlugin.buildView] method
198-
/// so the internal [GoogleMapsController] of a Web Map initializes as soon as
199-
/// possible. Check [_attachMapEvents] to see how this controller notifies the
197+
/// This method is eagerly called from the
198+
/// [GoogleMapsPlugin.buildViewWithConfiguration] method so the internal
199+
/// [GoogleMapsController] of a Web Map initializes as soon as possible.
200+
/// Check [_attachMapEvents] to see how this controller notifies the
200201
/// plugin of it being fully ready (through the `onTilesloaded.first` event).
201202
///
202203
/// Failure to call this method would result in the GMap not rendering at all,

0 commit comments

Comments
 (0)