Migrating To v4

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.

Please refer to the sections below for information on how to migrate your project. This will contain the changes that most users may need to make, but not all changes.

For a full list of changes, please see the full CHANGELOG, and make use of the old and new API reference.

TileLayer Changes

One of the major cores of flutter_map has been upgraded to the 21st century by a generous contributor (@rorystephenson). This increases the simplicity of the layer, and its performance!

Consolidated multiple properties into tileDisplay and tileUpdateTransformer

The following properties have been removed:

  • updateInterval

  • tileFadeInDuration

  • tileFadeInStart

  • tileFadeInStartWhenOverride

  • overrideTilesWhenUrlChanges

  • fastReplace

... and replaced with tileDisplay (TileDisplay) & tileUpdateTransformer (StreamTransformer<TileUpdateEvent, TileUpdateEvent>).

There is no "one size fits all" available for this migration: you'll need to experiment to find a combination of the two that work. Read the in-code API documentation for more information about what each one does.

Removed opacity property

To migrate, wrap the TileLayer with an Opacity widget.

Old Code (<4.0.0)
children: [
    TileLayer(
        // urlTemplate: '',
        opacity: 0.5,
    ),
],
New Code (4.0.0+)
children: [
    Opacity(
        opacity: 0.5,
        child: TileLayer(
            // urlTemplate: '',
        ),
    ),
],

Attribution Changes

Grey boxes get a little boring, don't you think? We think so as well, so we've developed a new interactive animated attribution layer that should cover all your needs.

pageAttribution Layer
Replaced AttributionWidget.defaultWidget with SimpleAttributionWidget

To migrate, replace with SimpleAttributionWidget and fill properties as necessary - see the in-code API documentation.

Removed AttributionWidget

To migrate, replace with an Align widget (and insert directly into the map's nonRotatedChildren).

Other Changes

Removed absorbPanEventsOnScrollables

Setting this to false was equivalent to disabling drag gestures through interactiveFlags.

To migrate plugin code, use onVerticalDrag and onHorizontalDrag updates instead of onPan. For more information, see https://github.com/fleaflet/flutter_map/pull/1455.

Changed some CustomPoint<T>s' generic type

CustomPoints previously used num as their generic type, which lead to type casting within FM and plugins, as some code only allowed int/double, not num.

Many of these have been updated to reflect their true usage.

To migrate, look for any methods which now take a different generic typed CustomPoint than was previously required. These should then be either casted at this location, or the source of the number should more accuratley represent what the number will be.

For more information, see https://github.com/fleaflet/flutter_map/pull/1482.

Last updated

© flutter_map Authors & Maintainers