flutter_map Integration

Stores also have the method getTileProvider(). This is the point of integration with flutter_map, providing browse caching through a custom image provider, and can be used as so:

import 'package:flutter_map/flutter_map.dart';

TileLayer(
    tileProvider: FMTC.instance('storeName').getTileProvider(),
),

Tile Provider Settings

FMTCTileProviderSettings can take the following arguments:

Note that using maxStoreLength can have a negative effect on performance, as sorting the tiles to find the oldest is (currently) expensive.

Cache Behavior

This enumerable contains 3 values, which are used to dictate which logic should be used to store and retrieve tiles from the store.

Check If A Tile Is Cached

The object returned by this function also has the method checkTileCached, with the following parameters:

FMTC.instance('storeName').getTileProvider().checkTileCached(
    coords: Coords<num>,
    options: TileLayer,
    customUrl: String?,
 )

Pass the coords of the tile to check for, and the same/similar TileLayer used to store the tile in the first place.

It will return a boolean dependent on whether or not the tile could be found.

Last updated

© Luka Stillingfleet (JaffaKetchup)