From 0dbc4cf27700e254bc3485975918f72f05086a4d Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Sat, 28 Jun 2025 09:35:07 -0400 Subject: [PATCH 1/2] [google_maps_flutter] Remove legacy renderer tests Removes the copy of the integration tests that attempted to run against the legacy renderer, as the legacy renderer is no longer available. The tests are now just duplicating integration tests (the slowest and flakiest tests, generally), and the test that asserts that it's testing the legacy renderer is now failing, closing the tree. Also removes the README discussion of the renderer option, since it's no longer useful to clients. Will fix the tree closure. Part of https://github.com/flutter/flutter/issues/171338 --- .../google_maps_flutter_android/CHANGELOG.md | 5 ++ .../google_maps_flutter_android/README.md | 33 +------------ .../integration_test/google_maps_tests.dart | 35 +++++++++++++- .../latest_renderer_test.dart | 47 ------------------- .../legacy_renderer_test.dart | 40 ---------------- .../google_maps_flutter_android/pubspec.yaml | 2 +- 6 files changed, 40 insertions(+), 122 deletions(-) delete mode 100644 packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/latest_renderer_test.dart delete mode 100644 packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/legacy_renderer_test.dart diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index 6071bc8027f4..1f4662c2a199 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.16.2 + +* Removes documentation related to the map renderer selection API, as the + legacy renderer is no longer available, so requesting it is a no-op. + ## 2.16.1 * Removes obsolete code related to supporting SDK <21. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/README.md b/packages/google_maps_flutter/google_maps_flutter_android/README.md index 450c6e5cfbf4..ac2a4c3ceb1b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/README.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/README.md @@ -46,42 +46,11 @@ This mode is more performant than Hybrid Composition and we recommend that you u This mode is available for backwards compatability and corresponds to `useAndroidViewSurface = true`. We do not recommend its use as it is less performant than Texture Layer Hybrid Composition and -certain flutter rendering effects are not supported. +certain flutter rendering effects are not supported. If you require this mode for correctness, please file a bug so we can investigate and fix the issue in the TLHC mode. -## Map renderer - -This plugin supports the option to request a specific [map renderer][5]. - -The renderer must be requested before creating GoogleMap instances, as the renderer can be initialized only once per application context. - - -```dart -AndroidMapRenderer mapRenderer = AndroidMapRenderer.platformDefault; -// ยทยทยท - final GoogleMapsFlutterPlatform mapsImplementation = - GoogleMapsFlutterPlatform.instance; - if (mapsImplementation is GoogleMapsFlutterAndroid) { - WidgetsFlutterBinding.ensureInitialized(); - mapRenderer = await mapsImplementation - .initializeWithRenderer(AndroidMapRenderer.latest); - } -``` - -`AndroidMapRenderer.platformDefault` corresponds to `AndroidMapRenderer.latest`. - -You are not guaranteed to get the requested renderer. For example, on emulators without -Google Play the latest renderer will not be available and the legacy renderer will always be used. - -WARNING: `AndroidMapRenderer.legacy` is known to crash apps and is no longer supported by the Google Maps team -and therefore cannot be supported by the Flutter team. - -### Cloud-based map styling - -Cloud-based map styling is not supported with the `AndroidMapRenderer.legacy` renderer. - ## Supported Heatmap Options | Field | Supported | diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart index 0a18e976b9f7..c51b7a849616 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart @@ -4,14 +4,15 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:typed_data'; import 'dart:ui' as ui; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; import 'package:google_maps_flutter_example/example_google_map.dart'; import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; +import 'package:integration_test/integration_test.dart'; import 'resources/icon_image_base64.dart'; @@ -42,7 +43,37 @@ final LatLngBounds _testCameraBounds = LatLngBounds( final ValueVariant _cameraUpdateTypeVariants = ValueVariant(CameraUpdateType.values.toSet()); -void googleMapsTests() { +void main() { + late AndroidMapRenderer initializedRenderer; + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + setUpAll(() async { + final GoogleMapsFlutterAndroid instance = + GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; + initializedRenderer = + await instance.initializeWithRenderer(AndroidMapRenderer.latest); + }); + + testWidgets('initialized with latest renderer', (WidgetTester _) async { + // There is no guarantee that the server will return the latest renderer + // even when requested, so there's no way to deterministically test that. + // Instead, just test that the request succeeded and returned a valid + // value. + expect( + initializedRenderer == AndroidMapRenderer.latest || + initializedRenderer == AndroidMapRenderer.legacy, + true); + }); + + testWidgets('throws PlatformException on multiple renderer initializations', + (WidgetTester _) async { + final GoogleMapsFlutterAndroid instance = + GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; + expect( + () async => instance.initializeWithRenderer(AndroidMapRenderer.latest), + throwsA(isA().having((PlatformException e) => e.code, + 'code', 'Renderer already initialized'))); + }); GoogleMapsFlutterPlatform.instance.enableDebugInspection(); // Repeatedly checks an asynchronous value against a test condition, waiting diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/latest_renderer_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/latest_renderer_test.dart deleted file mode 100644 index f739211a97f7..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/latest_renderer_test.dart +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; -import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; -import 'package:integration_test/integration_test.dart'; - -import 'google_maps_tests.dart' show googleMapsTests; - -void main() { - late AndroidMapRenderer initializedRenderer; - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - - setUpAll(() async { - final GoogleMapsFlutterAndroid instance = - GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; - initializedRenderer = - await instance.initializeWithRenderer(AndroidMapRenderer.latest); - }); - - testWidgets('initialized with latest renderer', (WidgetTester _) async { - // There is no guarantee that the server will return the latest renderer - // even when requested, so there's no way to deterministically test that. - // Instead, just test that the request succeeded and returned a valid - // value. - expect( - initializedRenderer == AndroidMapRenderer.latest || - initializedRenderer == AndroidMapRenderer.legacy, - true); - }); - - testWidgets('throws PlatformException on multiple renderer initializations', - (WidgetTester _) async { - final GoogleMapsFlutterAndroid instance = - GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; - expect( - () async => instance.initializeWithRenderer(AndroidMapRenderer.latest), - throwsA(isA().having((PlatformException e) => e.code, - 'code', 'Renderer already initialized'))); - }); - - // Run tests. - googleMapsTests(); -} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/legacy_renderer_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/legacy_renderer_test.dart deleted file mode 100644 index 95b1134d566f..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/legacy_renderer_test.dart +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; -import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; -import 'package:integration_test/integration_test.dart'; - -import 'google_maps_tests.dart' show googleMapsTests; - -void main() { - late AndroidMapRenderer initializedRenderer; - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - - setUpAll(() async { - final GoogleMapsFlutterAndroid instance = - GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; - initializedRenderer = - await instance.initializeWithRenderer(AndroidMapRenderer.legacy); - }); - - testWidgets('initialized with legacy renderer', (WidgetTester _) async { - expect(initializedRenderer, AndroidMapRenderer.legacy); - }); - - testWidgets('throws PlatformException on multiple renderer initializations', - (WidgetTester _) async { - final GoogleMapsFlutterAndroid instance = - GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; - expect( - () async => instance.initializeWithRenderer(AndroidMapRenderer.legacy), - throwsA(isA().having((PlatformException e) => e.code, - 'code', 'Renderer already initialized'))); - }); - - // Run tests. - googleMapsTests(); -} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index 84779722eb1c..0e105f3e1cbc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.16.1 +version: 2.16.2 environment: sdk: ^3.6.0 From 7af85c351850e29fffcffc4557a769d7acdaa9d9 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Sat, 28 Jun 2025 09:41:23 -0400 Subject: [PATCH 2/2] Fix name --- .../{google_maps_tests.dart => google_maps_test.dart} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/{google_maps_tests.dart => google_maps_test.dart} (100%) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart similarity index 100% rename from packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart rename to packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart index c51b7a849616..66e8af305626 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_tests.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart @@ -46,6 +46,7 @@ final ValueVariant _cameraUpdateTypeVariants = void main() { late AndroidMapRenderer initializedRenderer; IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + GoogleMapsFlutterPlatform.instance.enableDebugInspection(); setUpAll(() async { final GoogleMapsFlutterAndroid instance = @@ -74,7 +75,6 @@ void main() { throwsA(isA().having((PlatformException e) => e.code, 'code', 'Renderer already initialized'))); }); - GoogleMapsFlutterPlatform.instance.enableDebugInspection(); // Repeatedly checks an asynchronous value against a test condition, waiting // on frame between each check, returing the value if it passes the predicate