Snapshotter class final

A utility class for capturing styled map snapshots.

Use a Snapshotter when you need to capture a static snapshot of a map without using the actual MapWidget. You can configure the final result via MapSnapshotOptions upon construction time and then start the snapshot.

Properties

hashCode int
The hash code for this object.
no setterinherited
onMapLoadErrorListener OnMapLoadErrorListener?
Invoked whenever the map load errors out.
final
onStyleDataLoadedListener OnStyleDataLoadedListener?
Invoked when the requested style data has been loaded.
final
onStyleImageMissingListener OnStyleImageMissingListener?
Invoked whenever a style has a missing image. This event is emitted when the Map renders visible tiles and one of the required images is missing in the sprite sheet. Subscriber has to provide the missing image by calling StyleManager#addStyleImage method.
final
onStyleLoadedListener OnStyleLoadedListener?
Invoked when the requested style has been fully loaded, including the style, specified sprite and sources' metadata.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style StyleManager
A style object that can be manipulated to set different styles for a snapshot.
getter/setter pair

Methods

camera({required List<Point> coordinates, MbxEdgeInsets? padding, double? bearing, double? pitch}) Future<CameraOptions>
Calculates a CameraOptions to fit a list of coordinates.
cancel() Future<void>
Cancel the current snapshot operation, if any. The callback passed to the start method is called with error parameter set.
clearData() Future<void>
Clears temporary map data.
coordinateBounds(CameraOptions camera) Future<CoordinateBounds>
Returns the coordinate bounds corresponding to a given CameraOptions
dispose() Future<void>
Disposes the snapshotter instance. The instance should not be used after calling this method.
getCameraState() Future<CameraState>
The current state of the snapshotter camera.
getSize() Future<Size?>
The size of the snapshot image.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setCamera(CameraOptions cameraOptions) Future<void>
Set the current state of the snapshotter camera.
setSize(Size size) Future<void>
Set the size of the snapshot image.
start() Future<Uint8List?>
Request a new snapshot. If there is a pending snapshot request, it is cancelled automatically. Throws an error if the snapshot is cancelled.
tileCover(TileCoverOptions options) Future<List<CanonicalTileID?>>
Returns array of tile identifiers that cover current map camera.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create({required MapSnapshotOptions options, OnStyleLoadedListener? onStyleLoadedListener, OnMapLoadErrorListener? onMapLoadErrorListener, OnStyleDataLoadedListener? onStyleDataLoadedListener, OnStyleImageMissingListener? onStyleImageMissingListener}) Future<Snapshotter>
Creates a new Snapshotter instance. The style can be set using style.setStyleURI or style.setStyleJSON.