flutter_map Docs
Project Links💝 Support Us
v4
v4
  • flutter_map
  • How Does It Work?
    • Raster vs Vector Tiles
  • Getting Started
    • Installation
    • Additional Setup
    • Examples
    • Migrating To v4
  • Usage
    • Base Widget
    • Options
    • Layers
    • Controller
    • Full API Reference
  • Layers
    • Tile Layer
      • Tile Providers
    • Marker Layer
    • Polygon Layer
    • Polyline Layer
    • Circle Layer
    • Overlay Image Layer
    • Attribution Layer
    • WMS Usage
  • Plugins
    • Plugins List
    • Making A Plugin
      • Creating New Tile Providers
      • Creating New Layers
  • Tile Servers
    • Using Mapbox
    • Using Thunderforest
    • Using Stadia Maps
    • Offline Mapping
    • Other Options
  • Frequently Asked Questions
  • Contributing
  • Credits
Powered by GitBook

© flutter_map Authors & Maintainers

On this page
  • TileLayer Changes
  • Attribution Changes
  • Other Changes

Was this helpful?

Export as PDF
  1. Getting Started

Migrating To v4

PreviousExamplesNextBase Widget

Last updated 2 years ago

Was this helpful?

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 , 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.

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.

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.

Alternatively, consider implementing attribution using to take advantage of the new interactive, animated layer.

To migrate map code, use the interactiveFlags as above. See .

To migrate plugin code, use onVerticalDrag and onHorizontalDrag updates instead of onPan. For more information, see .

For more information, see .

CHANGELOG
Attribution Layer
https://github.com/fleaflet/flutter_map/pull/1455
https://github.com/fleaflet/flutter_map/pull/1482
Permanent Rules
RichAttributionWidget