create static method
Future<Snapshotter>
create({
- required MapSnapshotOptions options,
- OnStyleLoadedListener? onStyleLoadedListener,
- OnMapLoadErrorListener? onMapLoadErrorListener,
- OnStyleDataLoadedListener? onStyleDataLoadedListener,
- OnStyleImageMissingListener? onStyleImageMissingListener,
Creates a new Snapshotter instance.
The style can be set using style.setStyleURI or style.setStyleJSON.
Implementation
static Future<Snapshotter> create({
required MapSnapshotOptions options,
OnStyleLoadedListener? onStyleLoadedListener,
OnMapLoadErrorListener? onMapLoadErrorListener,
OnStyleDataLoadedListener? onStyleDataLoadedListener,
OnStyleImageMissingListener? onStyleImageMissingListener,
}) async {
final snapshotter = Snapshotter._(
options: options,
onStyleLoadedListener: onStyleLoadedListener,
onMapLoadErrorListener: onMapLoadErrorListener,
onStyleDataLoadedListener: onStyleDataLoadedListener,
onStyleImageMissingListener: onStyleImageMissingListener);
snapshotter._mapEvents._onStyleLoadedListener = onStyleLoadedListener;
snapshotter._mapEvents._onMapLoadErrorListener = onMapLoadErrorListener;
snapshotter._mapEvents._onStyleDataLoadedListener =
onStyleDataLoadedListener;
snapshotter._mapEvents._onStyleImageMissingListener =
onStyleImageMissingListener;
await _snapshotterInstanceManager.setupSnapshotterForSuffix(
snapshotter._suffix.toString(),
snapshotter._mapEvents.eventTypes.map((e) => e.index).toList(),
options);
Snapshotter._finalizer
.attach(snapshotter, snapshotter._suffix, detach: snapshotter);
return snapshotter;
}