Getting A Tile Provider
See 4. Connect to 'flutter_map' in the Quickstart guide for an example.
To integrate caching (known as 'browse caching' in FMTC), FMTC provides FMTCTileProvider
, which can be set in TileLayer.tileProvider
. The tile provider can communicate with the cache and get tiles from the network.
link
To know which stores to use from the cache, one or more store names may be specified, each with a BrowseStoreStrategy
.
Additionally, the argument otherStoresBehavior
may be used to set the BrowseStoreStrategy
for all unspecified stores. If null
, then no unspecified stores will be used.
BrowseStoreStrategy
BrowseStoreStrategy
The BrowseStoreStrategy
determines when tiles should be written to a store during browse caching. There are 3 available stratefies:
read
Only read tiles from the associated storereadUpdate
In addition to reading tiles, update existing tiles, but don't cache any new onesreadUpdateCreate
Read, update, and create tiles
Specifying Stores
Avoid getting/constructing the TileProvider
from within the build
er, especially if the widget is rebuilt frequently.
Using A Single Specified Store
To get an instance of the tile provider when only using a single store (except for otherStoresBehavior
), use the following method:
Using Multiple Specified Stores
To get an instance of the tile provider when using multiple stores, use the following method:
Using All Stores
To get an instance of the tile provider that will use all stores with the same StoreReadWriteBehavior
, use the following method:
Last updated