🚀What's New In v8.2?

Overview

Here's some highlights since v8.0:

Automatically enabled lightweight built-in caching & aborting of in-flight HTTP requests for obsolete tiles

Inverted filling for PolygonLayer & multi-yet-single world support for Poly*Layer

No more grey background at the North and South edges of your map (optionally)

Polygon label placement improvements

Documentation improvements

Information will appear in console when a TileLayer is loaded using one of the OpenStreetMap tile servers (in debug mode)

That's already a lot, but it's only scratching the surface. Alongside the community, we've improved our example app, reduced the size of our demo & package, - not even to mention the multiple bug fixes and other performance improvements.

Why not check out the CHANGELOG for the full list of curated changes, and the full commit and contributor listing if you like all the details:

CHANGELOG

For completeness, here were the highlights from v8.0:

  • Unbounded horizontal scrolling

  • Keyboard controls for map gestures

  • Performance improvements (particularly with Polygon/lineLayer)

Migration

To v8.2

Changes to Polygon label placement

It's usually simple to follow the deprecation messages/warnings in your IDE. The changes are described here for completeness.

There's two main changes:

  • The default placement algorithm has been changed The new default algorithm adopts the old name (centroid), with the old name becoming simpleCentroid - it's an improvement over the old algorithm

  • The Polygon.labelPlacement property & PolygonLabelPlacement enum have been deprecated, replaced with Polygon.labelPlacementCalculator and PolygonLabelPlacementCalculator respectively

Here's the mapping of old enum values to new objects:

  • old default / .centroid -> .centroid() (new algorithm)

  • .centroidWithMultiWorld -> .simpleMultiWorldCentroid()

  • .polylabel -> .polylabel()

  • (new) .simpleCentroid()

Deprecation of official CancellableNetworkTileProvider plugin

As described above, its primary purpose is now fulfilled by default in the NetworkTileProvider. You can switch back to that and remove the dependency from your project.

To v8.0

Most uses of Point<double> replaced by Offset & Size, Bounds<double> by Rect, and Bounds<int> by (IntegerBounds)

With the exception of some areas, uses of 'dart:math' objects, such as Point, have been replaced by equivalents from 'dart:ui' and Flutter libraries. There's multiple reasons for this:

  • These classes have been described as legacy since Feb 2024 in Dart/Flutter, and will be deprecated in future

  • This reduces internal casting (which we did a whole lot) and usage of generic types (which are inefficient), which has increased performance by around a millisecond or three (in a simple example)

  • The tooling and functionality provided by Dart/Flutter reduce the amount we need to maintain internally (reducing duplication), and work better together (such as easily building Rects from Offsets and Sizes

This breaks a large number of coordinate handling functions, such as those converting between geographic coordinates and screen space coordinates (the changed ones) in the MapCamera. We've also renamed some of these functions to remove references to 'point' and replace them with 'offset'.

Most migrations should be self explanatory. If necessary, you can view the PR to see what happened to a method you were using - there's very likely a close replacement! Some methods have been moved to internal usage only, but there's always easy alternatives.

Some external libraries still use the previous objects, and some of our use-cases are just not yet ready to be replaced by these options yet, so you may still find some of the old objects hiding around the codebase. IntegerBounds is internal only.

TileLayer.tileSize replaced by tileDimension

Just changing the argument identifier should be enough - we've just restricted the type to be an integer. You can't get tiles in fractional pixels anyway!

This renaming is also persisted throughout the internals.

Last updated

Was this helpful?