google_maps_flutter_android

The Android implementation of google_maps_flutter.

Usage

This package is endorsed, which means you can simply use google_maps_flutter normally. This package will be automatically included in your app when you do, so you do not need to add it to your pubspec.yaml.

However, if you import this package to use any of its APIs directly, you should add it to your pubspec.yaml as usual.

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.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) {
    // Force Hybrid Composition mode.
    mapsImplementation.useAndroidViewSurface = true;
  }
  // ···
}

Texture Layer Hybrid Composition

This is the current default mode and corresponds to useAndroidViewSurface = false. This mode is more performant than Hybrid Composition and we recommend that you use this mode.

Hybrid Composition

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.

If you require this mode for correctness, please file a bug so we can investigate and fix the issue in the TLHC mode.

Supported Heatmap Options

Field Supported
Heatmap.dissipating x
Heatmap.maxIntensity
Heatmap.minimumZoomIntensity x
Heatmap.maximumZoomIntensity x
HeatmapGradient.colorMapSize

Warmup

The first time a map is shown, the Google Maps SDK may briefly block the main thread, which could cause UI jank. If you prefer to control when this happens, you can call GoogleMapsFlutterAndroid.warmup() at some point before showing any maps to pre-warm the SDK. See this plugin's example code for one way of using this API.