MapController class abstract
Controller to programmatically interact with FlutterMap, such as controlling it and accessing some of its properties.
See https://docs.fleaflet.dev/usage/controller#initialisation for information on how to set-up and connect a controller to a map widget instance.
- Implementers
Constructors
- MapController()
-
Controller to programmatically interact with FlutterMap, such as
controlling it and accessing some of its properties.
factory
Properties
- bounds → LatLngBounds?
-
Current outer points/boundaries coordinates
no setter
- camera → MapCamera
-
Access the current MapCamera
no setter
- center → LatLng
-
Current center coordinates
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
mapEventStream
→ Stream<
MapEvent> -
Stream of all emitted MapEvents
no setter
- rotation → double
-
Current rotation in degrees, where 0° is North
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- zoom → double
-
Current zoom level
no setter
Methods
-
centerZoomFitBounds(
LatLngBounds bounds, {FitBoundsOptions options = const FitBoundsOptions(padding: EdgeInsets.all(12))}) → CenterZoom -
Calculates the appropriate center and zoom level for the map to perfectly
fit
bounds
, with additional configurableoptions
-
dispose(
) → void - Dispose of this controller.
-
fitBounds(
LatLngBounds bounds, {FitBoundsOptions options = const FitBoundsOptions(padding: EdgeInsets.all(12))}) → bool -
Move and zoom the map to perfectly fit
bounds
, with additional configurableoptions
-
fitCamera(
CameraFit cameraFit) → bool -
Move and zoom the map to fit
cameraFit
. -
latLngToScreenPoint(
LatLng mapCoordinate) → Point< double> - Convert a map coordinate (lat/lng) to its corresponding screen point (x/y), based on the map's current screen positioning
-
move(
LatLng center, double zoom, {Offset offset = Offset.zero, String? id}) → bool -
Moves and zooms the map to a
center
andzoom
level -
moveAndRotate(
LatLng center, double zoom, double degree, {String? id}) → MoveAndRotateResult - Calls move and rotate together, but is more efficient for the combined operation
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pointToLatLng(
Point< num> screenPoint) → LatLng - Convert a screen point (x/y) to its corresponding map coordinate (lat/lng), based on the map's current properties
-
rotate(
double degree, {String? id}) → bool -
Rotates the map to a decimal
degree
around the current center, where 0° is North -
rotateAroundPoint(
double degree, {Point< double> ? point, Offset? offset, String? id}) → MoveAndRotateResult -
Rotates the map to a decimal
degree
around a custom screen point, where 0° is North -
rotatePoint(
Point< num> mapCenter, Point<num> point, {bool counterRotation = true}) → Point<double> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
maybeOf(
BuildContext context) → MapController? - The controller for the closest FlutterMap ancestor. If this is called from a context with no FlutterMap ancestor a StateError will be thrown.
-
of(
BuildContext context) → MapController - The controller for the closest FlutterMap ancestor. If this is called from a context with no FlutterMap ancestor a StateError will be thrown.