Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google_maps_flutter] Annotate deprecated member usage #8214

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ void runTests() {

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

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

try {
// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
await controller.setMapStyle('invalid_value');
fail('expected MapStyleException');
} on MapStyleException catch (e) {
Expand All @@ -208,6 +212,8 @@ void runTests() {
);
final GoogleMapController controller = await controllerCompleter.future;

// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
await controller.setMapStyle(null);
});

Expand Down Expand Up @@ -471,6 +477,8 @@ void runTests() {
final Set<Marker> markers = <Marker>{
Marker(
markerId: const MarkerId('1'),
// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
icon: await BitmapDescriptor.fromAssetImage(
imageConfiguration,
'assets/red_square.png',
Expand All @@ -493,6 +501,8 @@ void runTests() {
final Set<Marker> markers = <Marker>{
Marker(
markerId: const MarkerId('1'),
// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
icon: BitmapDescriptor.fromBytes(
bytes,
size: const Size(100, 100),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,8 @@ void googleMapsTests() {
final Set<Marker> markers = <Marker>{
Marker(
markerId: const MarkerId('1'),
// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
icon: await BitmapDescriptor.fromAssetImage(
imageConfiguration,
'assets/red_square.png',
Expand All @@ -1427,6 +1429,8 @@ void googleMapsTests() {
final Set<Marker> markers = <Marker>{
Marker(
markerId: const MarkerId('1'),
// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
icon: BitmapDescriptor.fromBytes(
bytes,
size: const Size(100, 100),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
case final DefaultMarker marker:
return PlatformBitmap(
bitmap: PlatformBitmapDefaultMarker(hue: marker.hue?.toDouble()));
// Clients may still use this deprecated format, so it must be supported.
// ignore: deprecated_member_use
case final BytesBitmap bytes:
return PlatformBitmap(
bitmap: PlatformBitmapBytes(
Expand All @@ -895,6 +897,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
case final AssetBitmap asset:
return PlatformBitmap(
bitmap: PlatformBitmapAsset(name: asset.name, pkg: asset.package));
// Clients may still use this deprecated format, so it must be supported.
// ignore: deprecated_member_use
case final AssetImageBitmap asset:
return PlatformBitmap(
bitmap: PlatformBitmapAssetImage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,8 @@ void main() {
final Set<Marker> markers = <Marker>{
Marker(
markerId: const MarkerId('1'),
// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
icon: await BitmapDescriptor.fromAssetImage(
imageConfiguration,
'assets/red_square.png',
Expand All @@ -1268,6 +1270,8 @@ void main() {
testWidgets('markerWithLegacyBytes', (WidgetTester tester) async {
tester.view.devicePixelRatio = 2.0;
final Uint8List bytes = const Base64Decoder().convert(iconImageBase64);
// Intentionally testing the deprecated code path.
// ignore: deprecated_member_use
final BitmapDescriptor icon = BitmapDescriptor.fromBytes(
bytes,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,8 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform {
case final DefaultMarker marker:
return PlatformBitmap(
bitmap: PlatformBitmapDefaultMarker(hue: marker.hue?.toDouble()));
// Clients may still use this deprecated format, so it must be supported.
// ignore: deprecated_member_use
case final BytesBitmap bytes:
final Size? size = bytes.size;
return PlatformBitmap(
Expand All @@ -782,6 +784,8 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform {
case final AssetBitmap asset:
return PlatformBitmap(
bitmap: PlatformBitmapAsset(name: asset.name, pkg: asset.package));
// Clients may still use this deprecated format, so it must be supported.
// ignore: deprecated_member_use
case final AssetImageBitmap asset:
final Size? size = asset.size;
return PlatformBitmap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ class GoogleMapController {
/// own configuration and are rendered on top of a GMap instance later. This
/// happens in the second half of this method.
///
/// This method is eagerly called from the [GoogleMapsPlugin.buildView] method
/// so the internal [GoogleMapsController] of a Web Map initializes as soon as
/// possible. Check [_attachMapEvents] to see how this controller notifies the
/// This method is eagerly called from the
/// [GoogleMapsPlugin.buildViewWithConfiguration] method so the internal
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation had already changed to buildViewWithConfiguration, this comment was just outdated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

/// [GoogleMapsController] of a Web Map initializes as soon as possible.
/// Check [_attachMapEvents] to see how this controller notifies the
/// plugin of it being fully ready (through the `onTilesloaded.first` event).
///
/// Failure to call this method would result in the GMap not rendering at all,
Expand Down
Loading