To v3.0.0
This update brings major breaking changes for all users.
We apologise for any difficulty this may cause and time you may spend migrating.
However, this update is a part of our aim to simplify this library, and should improve stability, readability, and performance for you in the long term. In addition, this will make the library much easier to maintain and add new functionality to through plugins and future features.
For a full list of changes, please see the full CHANGELOG, and make use of the old and new API reference.

Application Migration

Please refer to the sections below for information on how to migrate your application. This will contain the changes that most users may need to make, but not all changes.
This version requires a minimum of Flutter 3.3.0. Use flutter upgrade to update to this version.
Removed layers in favour of children
Removed LayerWidgets & LayerOptions in favour of Layers
Replaced onMapCreated with onMapReady inside MapOptions
Removed MapController().onReady

Plugin Migration

Unfortunately, migrating plugins that implement custom layers is more difficult than just renaming in many cases. In good news, the new system requires no complex registration, and will simplify your code.
Previously, state was updated through a StreamBuilder. Since v3, state is updated using setState. This means your tile layer is now just a widget, for all intents and purposes, and anything you put in build will automatically be rebuilt when the map state changes.
For more information, see Creating New Layers.
To migrate, place any StreamBuilder implementation with the below code snippet, and the latest map state will automatically get passed down.
@override
Widget build(BuildContext context) {
final mapState = FlutterMapState.maybeOf(context)!;
// Use `mapState` as necessary, for example `mapState.zoom`
}
Your plugin may also now be able to be a StatelessWidget, which may increase performance and simplify your code!
In addition to that change:
Replaced MapState with FlutterMapState
Replaced getPixelOrigin with pixelOrigin inside FlutterMapState
Export as PDF
Copy link
Edit on GitHub
On this page
Application Migration
Plugin Migration