Get Camera
The MapCamera object describes the map's current viewport. It does not provide methods to change it: that is the responsibility of a MapController.
Usage Inside Of A FlutterMap Child
To get the camera from within the context of a FlutterMap widget, use MapCamera.of(context).
If this throws a StateError, try wrapping the concerned widget in a Builder, to ensure the FlutterMap widget is parenting the BuildContext. If this has no effect, use Usage Outside Of FlutterMap instead.
Usage Outside Of FlutterMap
Single Time
To get the camera from outside the context of the FlutterMap widget, you'll need to setup a MapController first: see Control Camera > Usage Outside Of FlutterMap.
Then, use the .camera getter.
Listen To Changes
Listen To EventsLast updated
Was this helpful?