Controller
To programatically interact with the map (such as panning, zooming and rotating) and receive it's events, you'll need a MapController.
Initialisation
To use a MapController, it must initialised like any other object and then passed to the FlutterMap. This attaches them until the map is disposed.
Usage In initState()
It is a fairly common requirement to need to use the MapController in initState(), before the map has been built. Unfortunately, this is not possible, as the map must be built for the controller to be attached.
This isn't a problem however! The MapOptions contains an onMapReady callback (see Event Handling) is called once when the map is initialised, and the initialised map controller can be used freely within it.
Animated Movements
Whilst animated movements through MapControllers aren't built-in, the community maintained plugin flutter_map_animations provides this, and much more!
The example application also includes a page demonstrating a custom animated map movement without the plugin.
Event Handling
Event HandlingLast updated
Was this helpful?