enableBaseMapCaching function
- MPMapboxStyleSource styleSource = const MPMapboxStyleSource.mapsIndoorsDefault(),
- MPDataSetCachingScope scope = MPDataSetCachingScope.full,
Enables caching of the map provider's own base-map tiles for the loaded dataset, so the base map underneath MapsIndoors still renders while the device is offline.
Call this after loadMapsIndoors and after a MapsIndoorsWidget has been built: the dataset is identified by the loaded API key, and the map provider registers the cache implementation when the map view is created. Called earlier, it returns an MPError with code MPError.baseMapCachingNotRegistered.
This only sets the flag. Nothing is downloaded until synchronizeBaseMapTiles is called.
styleSource must be the Mapbox style the live map renders, because caching one style while displaying another fails silently and only shows up as a blank base map when the device goes offline. It is read on Android only. On iOS the SDK caches the style the map is set up to render, including one set with MapsIndoorsWidget.mapStyleUri, so styleSource is ignored there and the same call works on both platforms.
scope governs how much MapsIndoors content is cached, and applies only when the dataset is not already being managed - which it usually is, because loadMapsIndoors registers it. It has no effect on which base-map tiles are downloaded.
Returns null on success, otherwise an MPError.
Implementation
Future<MPError?> enableBaseMapCaching(
{MPMapboxStyleSource styleSource =
const MPMapboxStyleSource.mapsIndoorsDefault(),
MPDataSetCachingScope scope = MPDataSetCachingScope.full}) =>
DataSetCachePlatform.instance.enableBaseMapCaching(styleSource, scope);