MapController class abstract interface Basic

The MapController can be used to control, update and manipulate a rendered MapLibreMap.

Properties

camera MapCamera?
Get the current camera position on the map.
no setter
hashCode int
The hash code for this object.
no setterinherited
options MapOptions
Get the MapOptions from MapLibreMap.options.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style StyleController?
Get the StyleController for the map. It returns null null if accessed before MapLibreMap.onStyleLoaded has been called.
no setter

Methods

animateCamera({Geographic? center, double? zoom, double? bearing, double? pitch, Duration nativeDuration = const Duration(seconds: 2), double webSpeed = 1.2, Duration? webMaxDuration}) Future<void>
Animate the map camera to a new location.
enableLocation({Duration fastestInterval = const Duration(milliseconds: 750), Duration maxWaitTime = const Duration(seconds: 1), bool pulseFade = true, bool accuracyAnimation = true, bool compassAnimation = true, bool pulse = true, BearingRenderMode bearingRenderMode = BearingRenderMode.gps}) Future<void>
Show the user location on the map
featuresAtPoint(Offset point, {List<String>? layerIds}) List<RenderedFeature>
Returns an array of rendered map features that intersect with a given screen location measured in logical pixels.
featuresInRect(Rect rect, {List<String>? layerIds}) List<RenderedFeature>
Returns an array of rendered map features that intersect with a given on-screen rectangle measured in logical pixels.
fitBounds({required LngLatBounds bounds, double? bearing, double? pitch, Duration nativeDuration = const Duration(seconds: 2), double webSpeed = 1.2, Duration? webMaxDuration, Offset offset = Offset.zero, double webMaxZoom = double.maxFinite, bool webLinear = false, EdgeInsets padding = EdgeInsets.zero}) Future<void>
Animate the map camera to a new location.
getCamera() MapCamera
Get the current camera position on the map.
getMetersPerPixelAtLatitude(double latitude) double
Returns the distance spanned by one logical pixel at the specified latitude and current zoom level.
getVisibleRegion() LngLatBounds
The smallest bounding box that includes the visible region.
moveCamera({Geographic? center, double? zoom, double? bearing, double? pitch}) Future<void>
Instantly move the map camera to a new location.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryLayers(Offset screenLocation) List<QueriedLayer>
Queries the map for layers containing rendered features which intersect with a given screenLocation measured in logical pixels.
setStyle(String style) → void
Asynchronously change the style of the map. style can be a JSON string representing a valid MapLibre style document, or a URL pointing to such a document.
toLngLat(Offset screenLocation) Geographic
Get the latitude/longitude coordinate for a screen location in logical pixels.
toLngLats(List<Offset> screenLocations) List<Geographic>
Get the latitude/longitude coordinate for a screen location in logical pixels.
toScreenLocation(Geographic lngLat) Offset
Convert a latitude/longitude coordinate to a screen location in logical pixels.
toScreenLocations(List<Geographic> lngLats) List<Offset>
Convert a latitude/longitude coordinate to a screen location in logical pixels.
toString() String
A string representation of this object.
inherited
trackLocation({bool trackLocation = true, BearingTrackMode trackBearing = BearingTrackMode.gps}) Future<void>
Track the user location on the map

Operators

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

Static Methods

maybeOf(BuildContext context) MapController?
Find the MapController of the closest MapLibreMap in the widget tree. Returns null if called outside of the MapLibreMap.children.
of(BuildContext context) MapController
Find the MapController of the closest MapLibreMap in the widget tree. Throws an StateError if called outside of the MapLibreMap.children.