Getting A Tile Provider
Last updated
Last updated
© Luka Stillingfleet (JaffaKetchup)
See 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
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 store
readUpdate
In addition to reading tiles, update existing tiles, but don't cache any new ones
readUpdateCreate
Read, update, and create tiles
Avoid getting/constructing the TileProvider
from within the build
er, especially if the widget is rebuilt frequently.
To get an instance of the tile provider when only using a single store (except for otherStoresBehavior
), use the following method:
To get an instance of the tile provider when using multiple stores, use the following method:
To get an instance of the tile provider that will use all stores with the same StoreReadWriteBehavior
, use the following method: