MapboxMap class
Controller for a single MapboxMap instance running on the host platform.
- Inheritance
-
- Object
- ChangeNotifier
- MapboxMap
Constructors
- MapboxMap({required _MapboxMapsPlatform mapboxMapsPlatform, OnStyleLoadedListener? onStyleLoadedListener, OnCameraChangeListener? onCameraChangeListener, OnMapIdleListener? onMapIdleListener, OnMapLoadedListener? onMapLoadedListener, OnMapLoadErrorListener? onMapLoadErrorListener, OnRenderFrameStartedListener? onRenderFrameStartedListener, OnRenderFrameFinishedListener? onRenderFrameFinishedListener, OnSourceAddedListener? onSourceAddedListener, OnSourceDataLoadedListener? onSourceDataLoadedListener, OnSourceRemovedListener? onSourceRemovedListener, OnStyleDataLoadedListener? onStyleDataLoadedListener, OnStyleImageMissingListener? onStyleImageMissingListener, OnStyleImageUnusedListener? onStyleImageUnusedListener, OnMapTapListener? onMapTapListener, OnMapLongTapListener? onMapLongTapListener, OnMapScrollListener? onMapScrollListener})
Properties
- annotations ↔ _AnnotationManager
-
The interface to create and set annotations.
latefinal
- attribution ↔ AttributionSettingsInterface
-
The interface to access the attribution settings.
getter/setter pair
- compass ↔ CompassSettingsInterface
-
The interface to access the compass settings.
getter/setter pair
- gestures ↔ GesturesSettingsInterface
-
The interface to access the gesture settings.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- location ↔ LocationComponentSettingsInterface
-
The interface to set the location puck.
getter/setter pair
- logo ↔ LogoSettingsInterface
-
The interface to set the logo settings.
getter/setter pair
- onCameraChangeListener → OnCameraChangeListener?
-
Invoked whenever camera position changes.
final
- onMapIdleListener → OnMapIdleListener?
-
Invoked when the Map has entered the idle state. The Map is in the idle state when there are no ongoing transitions
and the Map has rendered all available tiles.
final
- onMapLoadedListener → OnMapLoadedListener?
-
Invoked when the Map's style has been fully loaded, and the Map has rendered all visible tiles.
final
- onMapLoadErrorListener → OnMapLoadErrorListener?
-
Invoked whenever the map load errors out
final
- onMapLongTapListener ↔ OnMapLongTapListener?
-
getter/setter pair
- onMapScrollListener ↔ OnMapScrollListener?
-
getter/setter pair
- onMapTapListener ↔ OnMapTapListener?
-
getter/setter pair
- onRenderFrameFinishedListener → OnRenderFrameFinishedListener?
-
Invoked whenever the Map finished rendering a frame.
The render-mode value tells whether the Map has all data ("full") required to render the visible viewport.
The needs-repaint value provides information about ongoing transitions that trigger Map repaint.
The placement-changed value tells if the symbol placement has been changed in the visible viewport.
final
- onRenderFrameStartedListener → OnRenderFrameStartedListener?
-
Invoked whenever the Map started rendering a frame.
final
- onSourceAddedListener → OnSourceAddedListener?
-
Invoked whenever the Source has been added with StyleManager#addStyleSource runtime API.
final
- onSourceDataLoadedListener → OnSourceDataLoadedListener?
-
Invoked when the requested source data has been loaded.
final
- onSourceRemovedListener → OnSourceRemovedListener?
-
Invoked whenever the Source has been removed with StyleManager#removeStyleSource runtime API.
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
- onStyleImageUnusedListener → OnStyleImageUnusedListener?
-
Invoked whenever an image added to the Style is no longer needed and can be removed using StyleManager#removeStyleImage method.
final
- onStyleLoadedListener → OnStyleLoadedListener?
-
Invoked when the requested style has been fully loaded, including the style, specified sprite and sources' metadata.
final
- projection ↔ Projection
-
The map projection of the style.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleBar ↔ ScaleBarSettingsInterface
-
The interface to access the compass settings.
getter/setter pair
- style ↔ StyleManager
-
The currently loaded Style]object.
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
cameraForCoordinateBounds(
CoordinateBounds bounds, MbxEdgeInsets padding, double? bearing, double? pitch) → Future< CameraOptions> -
Convenience method that returns the
camera options
object for given parameters. -
cameraForCoordinates(
List< Map< coordinates, MbxEdgeInsets padding, double? bearing, double? pitch) → Future<String?, Object?> ?>CameraOptions> -
Convenience method that returns the
camera options
object for given parameters. -
cameraForCoordinatesCameraOptions(
List< Map< coordinates, CameraOptions camera, ScreenBox box) → Future<String?, Object?> ?>CameraOptions> -
Convenience method that adjusts the provided
camera options
object for given parameters. -
cameraForGeometry(
Map< String?, Object?> geometry, MbxEdgeInsets padding, double? bearing, double? pitch) → Future<CameraOptions> -
Convenience method that returns the
camera options
object for given parameters. -
cancelCameraAnimation(
) → Future< void> - Cancel the ongoing camera animation if there is one.
-
clearData(
) → Future< void> - Clears temporary map data.
-
coordinateBoundsForCamera(
CameraOptions camera) → Future< CoordinateBounds> -
Returns the
coordinate bounds
for a given camera. -
coordinateBoundsForCameraUnwrapped(
CameraOptions camera) → Future< CoordinateBounds> -
Returns the
coordinate bounds
for a given camera. -
coordinateBoundsZoomForCamera(
CameraOptions camera) → Future< CoordinateBoundsZoom> -
Returns the
coordinate bounds
and thezoom
for a givencamera
. -
coordinateBoundsZoomForCameraUnwrapped(
CameraOptions camera) → Future< CoordinateBoundsZoom> -
Returns the unwrapped
coordinate bounds
andzoom
for a givencamera
. -
coordinateForPixel(
ScreenCoordinate pixel) → Future< Map< String?, Object?> > -
Calculates a geographical
coordinate
(i.e., longitude-latitude pair) that corresponds to ascreen coordinate
. -
coordinatesForPixels(
List< ScreenCoordinate?> pixels) → Future<List< Map< >String?, Object?> ?> -
Calculates geographical
coordinates
(i.e., longitude-latitude pairs) that correspond toscreen coordinates
. -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
dragEnd(
) → Future< void> -
Ends the ongoing drag gesture. This function should be called always after the user has ended a drag gesture initiated by
dragStart
. -
dragStart(
ScreenCoordinate point) → Future< void> -
Prepares the drag gesture to use the provided screen coordinate as a pivot
point
. This function should be called each time when user starts a dragging action (e.g. by clicking on the map). The following dragging will be relative to the pivot. -
easeTo(
CameraOptions cameraOptions, MapAnimationOptions? mapAnimationOptions) → Future< void> - Ease the map camera to a given camera options and animation options
-
flyTo(
CameraOptions cameraOptions, MapAnimationOptions? mapAnimationOptions) → Future< void> - Fly the map camera to a given camera options.
-
getBounds(
) → Future< CameraBounds> -
Returns the
camera bounds
of the map. -
getCameraState(
) → Future< CameraState> -
Returns the current
camera state
. -
getDebug(
) → Future< List< MapDebugOptions?> > -
Returns the
map debug options
. -
getDragCameraOptions(
ScreenCoordinate fromPoint, ScreenCoordinate toPoint) → Future< CameraOptions> -
Calculates target point where camera should move after drag. The method should be called after
dragStart
and beforedragEnd
. -
getElevation(
Map< String?, Object?> coordinate) → Future<double?> - Gets elevation for the given coordinate. Note: Elevation is only available for the visible region on the screen and with terrain enabled.
-
getFeatureState(
String sourceId, String? sourceLayerId, String featureId) → Future< String> - Gets the state map of a feature within a style source.
-
getGeoJsonClusterChildren(
String sourceIdentifier, Map< String?, Object?> cluster) → Future<FeatureExtensionValue> - Returns the children (original points or clusters) of a cluster (on the next zoom level) given its id (cluster_id value from feature properties) from a GeoJsonSource.
-
getGeoJsonClusterExpansionZoom(
String sourceIdentifier, Map< String?, Object?> cluster) → Future<FeatureExtensionValue> - Returns the zoom on which the cluster expands into several children (useful for "click to zoom" feature) given the cluster's cluster_id (cluster_id value from feature properties) from a GeoJsonSource.
-
getGeoJsonClusterLeaves(
String sourceIdentifier, Map< String?, Object?> cluster, int? limit, int? offset) → Future<FeatureExtensionValue> - Returns all the leaves (original points) of a cluster (given its cluster_id) from a GeoJsonSource, with pagination support: limit is the number of leaves to return (set to Infinity for all points), and offset is the amount of points to skip (for pagination).
-
getMapOptions(
) → Future< MapOptions> -
Returns the
map options
. -
getPrefetchZoomDelta(
) → Future< int> - Returns the map's prefetch zoom delta.
-
getResourceOptions(
) → Future< ResourceOptions> - Gets the resource options for the map.
-
getSize(
) → Future< Size> - Gets the size of the map. Note : not supported for iOS.
-
isGestureInProgress(
) → Future< bool> -
Returns
true
if a gesture is currently in progress. -
isUserAnimationInProgress(
) → Future< bool> -
Returns
true
if user animation is currently in progress. -
loadStyleJson(
String styleJson) → Future< void> - Loads a style from a JSON string, calling a completion closure when the style is fully loaded or there has been an error during load.
-
loadStyleURI(
String styleURI) → Future< void> - Will load a new map style asynchronous from the specified URI.
-
moveBy(
ScreenCoordinate screenCoordinate, MapAnimationOptions? mapAnimationOptions) → Future< void> - Move the map by a given screen coordinate with optional animation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pitchBy(
double pitch, MapAnimationOptions? mapAnimationOptions) → Future< void> - Pitch the map by with optional animation.
-
pixelForCoordinate(
Map< String?, Object?> coordinate) → Future<ScreenCoordinate> -
Calculates a
screen coordinate
that corresponds to a geographical coordinate (i.e., longitude-latitude pair). -
pixelsForCoordinates(
List< Map< coordinates) → Future<String?, Object?> ?>List< ScreenCoordinate?> > -
Calculates
screen coordinates
that correspond to geographicalcoordinates
(i.e., longitude-latitude pairs). -
queryRenderedFeatures(
RenderedQueryGeometry geometry, RenderedQueryOptions options) → Future< List< QueriedFeature?> > - Queries the map for rendered features.
-
querySourceFeatures(
String sourceId, SourceQueryOptions options) → Future< List< QueriedFeature?> > - Queries the map for source features.
-
reduceMemoryUse(
) → Future< void> - Reduces memory use. Useful to call when the application gets paused or sent to background.
-
removeFeatureState(
String sourceId, String? sourceLayerId, String featureId, String? stateKey) → Future< void> - Removes entries from a feature state object.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
rotateBy(
ScreenCoordinate first, ScreenCoordinate second, MapAnimationOptions? mapAnimationOptions) → Future< void> - Rotate the map by with optional animation.
-
scaleBy(
double amount, ScreenCoordinate? screenCoordinate, MapAnimationOptions? mapAnimationOptions) → Future< void> - Scale the map by with optional animation.
-
setBounds(
CameraBoundsOptions options) → Future< void> -
Sets the
camera bounds options
of the map. The map will retain its current values for any details not passed via the camera bounds options arguments. When camera bounds options are set, the camera center is constrained by these bounds, as well as the minimum zoom level of the camera, to prevent out of bounds areas to be visible. Note that tilting or rotating the map, or setting stricter minimum and maximum zoom withinoptions
may still cause some out of bounds areas to become visible. -
setCamera(
CameraOptions cameraOptions) → Future< void> -
Changes the map view by any combination of center, zoom, bearing, and pitch, without an animated transition.
The map will retain its current values for any details not passed via the camera options argument.
It is not guaranteed that the provided
camera options
will be set, the map may apply constraints resulting in a differentcamera state
. -
setConstrainMode(
ConstrainMode mode) → Future< void> -
Sets the map
constrain mode
. -
setDebug(
List< MapDebugOptions?> debugOptions, bool value) → Future<void> -
Sets the
map debug options
and enables debug mode based on the passed value. -
setFeatureState(
String sourceId, String? sourceLayerId, String featureId, String state) → Future< void> - Updates the state object of a feature within a style source.
-
setGestureInProgress(
bool inProgress) → Future< void> - Tells the map rendering engine that there is currently a gesture in progress. This affects how the map renders labels, as it will use different texture filters if a gesture is ongoing.
-
setMemoryBudget(
MapMemoryBudgetInMegabytes? mapMemoryBudgetInMegabytes, MapMemoryBudgetInTiles? mapMemoryBudgetInTiles) → Future< void> - The memory budget hint to be used by the map. The budget can be given in tile units or in megabytes. A Map will do the best effort to keep memory allocations for a non essential resources within the budget.
-
setNorthOrientation(
NorthOrientation orientation) → Future< void> -
Sets the north
orientation mode
. -
setOnMapLongTapListener(
OnMapLongTapListener? onMapLongTapListener) → void -
setOnMapMoveListener(
OnMapScrollListener? onMapScrollListener) → void -
setOnMapTapListener(
OnMapTapListener? onMapTapListener) → void -
setPrefetchZoomDelta(
int delta) → Future< void> -
When loading a map, if prefetch zoom
delta
is set to any number greater than 0, the map will first request a tile at zoom level lower thanzoom - delta
, with requested zoom level a multiple ofdelta
, in an attempt to display a full map at lower resolution as quick as possible. -
setUserAnimationInProgress(
bool inProgress) → Future< void> -
Tells the map rendering engine that the animation is currently performed by the
user (e.g. with a
setCamera
calls series). It adjusts the engine for the animation use case. In particular, it brings more stability to symbol placement and rendering. -
setViewportMode(
ViewportMode mode) → Future< void> -
Sets the
viewport mode
. -
subscribe(
Observer observer, List< String> events) → void -
Subscribes an
observer
to a provided array of event types. Theobservable
will hold a strong reference to anobserver
instance, therefore, in order to stop receiving notifications, caller must callunsubscribe
with anobserver
instance used for an initial subscription. -
toString(
) → String -
A string representation of this object.
inherited
-
triggerRepaint(
) → Future< void> - Triggers a repaint of the map.
-
unsubscribe(
Observer observer, List< String> events) → void -
Unsubscribes an
observer
from a provided array of event types. -
unsubscribeAll(
Observer observer) → void -
Unsubscribes an
observer
from all events.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited