google_maps_flutter_android_ground_overlays 1.0.0 google_maps_flutter_android_ground_overlays: ^1.0.0 copied to clipboard
Android implementation of the google_maps_flutter plugin.
google_maps_flutter_android #
The Android implementation of google_maps_flutter_ground_overlays
.
Usage #
This package is endorsed, which means you can simply use
google_maps_flutter_ground_overlays
normally. This package will be automatically included in
your app when you do.
Display Mode #
This plugin supports two different platform view display modes. The default display mode is subject to change in the future, and will not be considered a breaking change, so if you want to ensure a specific mode you can set it explicitly:
import 'package:google_maps_flutter_android/google_maps_flutter_android_ground_overlays.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
void main() {
// Require Hybrid Composition mode on Android.
final GoogleMapsFlutterPlatform mapsImplementation =
GoogleMapsFlutterPlatform.instance;
if (mapsImplementation is GoogleMapsFlutterAndroid) {
mapsImplementation.useAndroidViewSurface = true;
}
// ···
}
Hybrid Composition #
This is the current default mode, and corresponds to
useAndroidViewSurface = true
. It ensures that the map display will work as
expected, at the cost of some performance.
Texture Layer Hybrid Composition #
This is a new display mode used by most plugins starting with Flutter 3.0, and
corresponds to useAndroidViewSurface = false
. This is more performant than
Hybrid Composition, but currently misses certain map updates.
This mode will likely become the default in future versions if/when the missed updates issue can be resolved.
Map renderer #
This plugin supports the option to request a specific map renderer.
The renderer must be requested before creating GoogleMap instances, as the renderer can be initialized only once per application context.
AndroidMapRenderer mapRenderer = AndroidMapRenderer.platformDefault;
// ···
final GoogleMapsFlutterPlatform mapsImplementation =
GoogleMapsFlutterPlatform.instance;
if (mapsImplementation is GoogleMapsFlutterAndroid) {
WidgetsFlutterBinding.ensureInitialized();
mapRenderer = await mapsImplementation
.initializeWithRenderer(AndroidMapRenderer.latest);
}
Available values are AndroidMapRenderer.latest
, AndroidMapRenderer.legacy
, AndroidMapRenderer.platformDefault
.
Note that getting the requested renderer as a response is not guaranteed.