MapboxMapController class
Controller for a single MapboxMap instance running on the host platform.
Change listeners are notified upon changes to any of
- the
options
property - the collection of Symbols added to this map
- the collection of Lines added to this map
- the isCameraMoving property
- the cameraPosition property
Listeners are notified after changes have been applied on the platform side.
Symbol tap events can be received by adding callbacks to onSymbolTapped. Line tap events can be received by adding callbacks to onLineTapped. Circle tap events can be received by adding callbacks to onCircleTapped.
- Inheritance
-
- Object
- ChangeNotifier
- MapboxMapController
Properties
- cameraPosition → CameraPosition?
-
Returns the most recent camera position reported by the platform side.
Will be null, if
MapboxMap.trackCameraPosition
is false.no setter -
circles
→ Set<
Circle> -
The current set of circles on this map.
no setter
-
fills
→ Set<
Fill> -
The current set of fills on this map.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isCameraMoving → bool
-
True if the map camera is currently moving.
no setter
-
lines
→ Set<
Line> -
The current set of lines on this map.
no setter
- onCameraIdle → OnCameraIdleCallback?
-
final
- onCameraMovingStarted → OnCameraIdleCallback?
-
final
- onCameraTrackingChanged → OnCameraTrackingChangedCallback?
-
final
- onCameraTrackingDismissed → OnCameraTrackingDismissedCallback?
-
final
-
onCircleTapped
→ ArgumentCallbacks<
Circle> -
Callbacks to receive tap events for symbols placed on this map.
final
-
onFillTapped
→ ArgumentCallbacks<
Fill> -
Callbacks to receive tap events for fills placed on this map.
final
-
onInfoWindowTapped
→ ArgumentCallbacks<
Symbol> -
Callbacks to receive tap events for info windows on symbols
final
-
onLineTapped
→ ArgumentCallbacks<
Line> -
Callbacks to receive tap events for lines placed on this map.
final
- onMapClick → OnMapClickCallback?
-
final
- onMapIdle → OnMapIdleCallback?
-
final
- onMapLongClick → OnMapLongClickCallback?
-
final
-
onRouteSelected
→ ArgumentCallbacks<
int> -
final
- onStyleLoadedCallback → OnStyleLoadedCallback?
-
final
-
onSymbolTapped
→ ArgumentCallbacks<
Symbol> -
Callbacks to receive tap events for symbols placed on this map.
final
- onUserLocationUpdated → OnUserLocationUpdated?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
symbols
→ Set<
Symbol> -
The current set of symbols on this map.
no setter
Methods
-
addCircle(
CircleOptions options, [Map? data]) → Future< Circle> -
Adds a circle to the map, configured using the specified custom
options
. -
addCustomLayer(
{required String layerId, required LayerType layerType, required String sourceUrl, String? layerAbove, String? layerBelow, LayerOptions? options}) → Future< void> -
addFill(
FillOptions options, [Map? data]) → Future< Fill> -
Adds a fill to the map, configured using the specified custom
options
. -
addImage(
String name, Uint8List bytes, [bool sdf = false]) → Future< void> - Adds an image to the style currently displayed in the map, so that it can later be referred to by the provided name.
-
addImageSource(
String name, Uint8List bytes, LatLngQuad coordinates) → Future< void> - Adds an image source to the style currently displayed in the map, so that it can later be referred to by the provided name.
-
addLayer(
String name, String sourceId) → Future< void> - Adds layer with name
-
addLine(
LineOptions options, [Map? data]) → Future< Line> -
Adds a line to the map, configured using the specified custom
options
. -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addSymbol(
SymbolOptions options, [Map? data]) → Future< Symbol> -
Adds a symbol to the map, configured using the specified custom
options
. -
addSymbols(
List< SymbolOptions> options, [List<Map?> ? data]) → Future<List< Symbol> > -
animateCamera(
{required CameraUpdate cameraUpdate, int? duration}) → Future< bool?> - Starts an animated change of the map camera position.
-
buildRoute(
{required List< WayPoint> wayPoints, VTMapOptions? options}) → Future<bool?> - Build the Route Used for the Navigation
-
buildView(
Map< String, dynamic> creationParams, Function onPlatformViewCreated, Set<Factory< gestureRecognizers) → WidgetOneSequenceGestureRecognizer> > -
clearCircles(
) → Future< void> - Removes all circles from the map.
-
clearLines(
) → Future< void> - Removes all lines from the map.
-
clearRoute(
) → Future< void> -
clearSymbols(
) → Future< void> - Removes all symbols from the map.
-
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).
inherited
-
getCircleLatLng(
Circle circle) → Future< LatLng> -
Retrieves the current position of the circle.
This may be different from the value of
circle.options.geometry
if the circle is draggable. In that case this method provides the circle's actual position, andcircle.options.geometry
the last programmatically set position. -
getLineLatLngs(
Line line) → Future< List< LatLng> > -
Retrieves the current position of the line.
This may be different from the value of
line.options.geometry
if the line is draggable. In that case this method provides the line's actual position, andline.options.geometry
the last programmatically set position. -
getMetersPerPixelAtLatitude(
double latitude) → Future< double?> -
Returns the distance spanned by one pixel at the specified
latitude
and current zoom level. The distance between pixels decreases as the latitude approaches the poles. This relationship parallels the relationship between longitudinal coordinates at different latitudes. -
getSymbolLatLng(
Symbol symbol) → Future< LatLng> -
Retrieves the current position of the symbol.
This may be different from the value of
symbol.options.geometry
if the symbol is draggable. In that case this method provides the symbol's actual position, andsymbol.options.geometry
the last programmatically set position. -
getTelemetryEnabled(
) → Future< bool?> - Retrieves whether collection of anonymized telemetry data is enabled.
-
getVisibleRegion(
) → Future< LatLngBounds> - This method returns the boundaries of the region currently displayed in the map.
-
invalidateAmbientCache(
) → Future -
matchMapLanguageWithDeviceDefault(
) → Future< void> - Updates the language of the map labels to match the device's language.
-
moveCamera(
CameraUpdate cameraUpdate) → Future< bool?> - Instantaneously re-position the camera. Note: moveCamera() quickly moves the camera, which can be visually jarring for a user. Strongly consider using the animateCamera() methods instead because it's less abrupt.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
queryRenderedFeatures(
Point< double> point, List<String> layerIds, List<Object> ? filter) → Future<List?> -
queryRenderedFeaturesInRect(
Rect rect, List< String> layerIds, String filter) → Future<List?> -
removeCircle(
Circle circle) → Future< void> -
Removes the specified
circle
from the map. The circle must be a current member of the circles set. -
removeFill(
Fill fill) → Future< void> -
Removes the specified
fill
from the map. The fill must be a current member of the fills set. -
removeImageSource(
String name) → Future< void> - Removes previously added image source by name
-
removeLayer(
String name) → Future< void> - Removes layer by name
-
removeLine(
Line line) → Future< void> -
Removes the specified
line
from the map. The line must be a current member of the lines set. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
removeSymbol(
Symbol symbol) → Future< void> -
Removes the specified
symbol
from the map. The symbol must be a current member of the symbols set. -
removeSymbols(
Iterable< Symbol> symbols) → Future<void> -
requestMyLocationLatLng(
) → Future< LatLng> - Get last my location
-
selectedRoute(
int routeSelectedIndex, EdgeInsets padding) → Future< void> -
setMapLanguage(
String language) → Future< void> - Updates the language of the map labels to match the specified language. Supported language strings are available here: https://github.com/mapbox/mapbox-plugins-android/blob/e29c18d25098eb023a831796ff807e30d8207c36/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/MapLocale.java#L39-L87
-
setStyle(
String styleString) → Future< void> -
setSymbolIconAllowOverlap(
bool enable) → Future< void> - For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
-
setSymbolIconIgnorePlacement(
bool enable) → Future< void> - For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
-
setSymbolTextAllowOverlap(
bool enable) → Future< void> - For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
-
setSymbolTextIgnorePlacement(
bool enable) → Future< void> - For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
-
setTelemetryEnabled(
bool enabled) → Future< void> - Enables or disables the collection of anonymized telemetry data.
-
showOrHideLayer(
String layerId, bool isShow) → Future< void> -
toLatLng(
Point< num> screenLocation) → Future<LatLng> -
Returns the geographic location (as
LatLng
) that corresponds to a point on the screen. The screen location is specified in screen pixels (not display pixels) relative to the top left of the map (not the top left of the whole screen). -
toScreenLocation(
LatLng latLng) → Future< Point< num> > -
Returns the point on the screen that corresponds to a geographical coordinate (
latLng
). The screen location is in screen pixels (not display pixels) relative to the top left of the map (not of the whole screen) -
toString(
) → String -
A string representation of this object.
inherited
-
updateCircle(
Circle circle, CircleOptions changes) → Future< void> -
Updates the specified
circle
with the givenchanges
. The circle must be a current member of the circles set. -
updateContentInsets(
EdgeInsets insets, [bool animated = false]) → Future< void> - Updates the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport, optionally animating the change.
-
updateFill(
Fill fill, FillOptions changes) → Future< void> -
Updates the specified
fill
with the givenchanges
. The fill must be a current member of the fills set. -
updateLine(
Line line, LineOptions changes) → Future< void> -
Updates the specified
line
with the givenchanges
. The line must be a current member of the lines set. -
updateMyLocationTrackingMode(
MyLocationTrackingMode myLocationTrackingMode) → Future< void> - Updates user location tracking mode.
-
updateSymbol(
Symbol symbol, SymbolOptions changes) → Future< void> -
Updates the specified
symbol
with the givenchanges
. The symbol must be a current member of the symbols set.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
init(
int id, CameraPosition initialCameraPosition, {OnStyleLoadedCallback? onStyleLoadedCallback, OnMapClickCallback? onMapClick, OnUserLocationUpdated? onUserLocationUpdated, OnMapLongClickCallback? onMapLongClick, OnCameraTrackingDismissedCallback? onCameraTrackingDismissed, OnCameraTrackingChangedCallback? onCameraTrackingChanged, OnCameraIdleCallback? onCameraIdle, OnMapIdleCallback? onMapIdle, OnCameraMovingStartedCallBack? onCameraMovingStarted}) → MapboxMapController -
initPlatform(
int id) → Future< void>