GemMap constructor

const GemMap({
  1. Key? key,
  2. void onMapCreated(
    1. GemMapController
    )?,
  3. AndroidViewMode androidViewMode = AndroidViewMode.auto,
  4. Coordinates? coordinates,
  5. RectangleGeographicArea? area,
  6. int? zoomLevel,
  7. String? appAuthorization,
  8. String? initialMapStyleAsset,
  9. bool allowInternetConnection = true,
  10. AutoUpdateSettings? autoUpdateSettings,
})

Create a GemMap widget which renders an interactive map view.

The GemMap is the primary widget for embedding a Magic Lane map into a Flutter application. It initializes the underlying native map, handles platform-specific view composition, and provides a GemMapController through the onMapCreated callback to interact with the map programmatically.

Use the appAuthorization parameter to pass your project token. The initialMapStyleAsset allows applying a custom map style from the app's assets when the map is first created.

Example

const GemMap(
  appAuthorization: projectApiToken,
  onMapCreated: (GemMapController controller) {
    // Use controller to center, add overlays, etc.
  },
);

Parameters

  • onMapCreated: (void Function(GemMapController)?) Optional callback invoked with a GemMapController once the native map has been initialized and is ready for use.
  • androidViewMode: (AndroidViewMode) Mode for embedding native Android views. Defaults to AndroidViewMode.auto which chooses the best mode depending on Android version.
  • coordinates: (Coordinates?) Optional initial center coordinates for the map.
  • area: (RectangleGeographicArea?) Optional geographic area to center and fit the map to on creation.
  • zoomLevel: (int?) Optional initial zoom level for the map center. Useful when coordinates is provided.
  • appAuthorization: (String?) Optional project token used to initialize the SDK. If the SDK is already initialized this parameter is ignored.
  • initialMapStyleAsset: (String?) Optional path to a .style asset declared in pubspec.yaml. Example: 'assets/map_styles/my_map_style.style'.
  • allowInternetConnection: (bool) When false, prevents SDK from using network resources during native initialization. Default: true.
  • autoUpdateSettings: (AutoUpdateSettings?) Optional AutoUpdateSettings used when loading native binaries; ignored if SDK is already initialized.

See also:

Implementation

const GemMap({
  super.key,
  final void Function(GemMapController)? onMapCreated,
  final AndroidViewMode androidViewMode = AndroidViewMode.auto,
  final Coordinates? coordinates,
  final RectangleGeographicArea? area,
  final int? zoomLevel,
  final String? appAuthorization,
  final String? initialMapStyleAsset,
  final bool allowInternetConnection = true,
  final AutoUpdateSettings? autoUpdateSettings,
}) : _initialMapStyleAsset = initialMapStyleAsset,
     _appAuthorization = appAuthorization,
     _zoomLevel = zoomLevel,
     _area = area,
     _coordinates = coordinates,
     _androidViewMode = androidViewMode,
     _onMapCreated = onMapCreated,
     _autoUpdateSettings = autoUpdateSettings,
     _allowInternetConnection = allowInternetConnection;