getTileProvider method
- @Deprecated('Use the `FMTCTileProvider` default constructor instead. ' 'This will reduce internal codebase complexity and maximise external ' 'flexibility, and works toward a potential future decentralised API ' 'design. ' 'This feature was deprecated in v10, and will be removed in a future ' 'version.')
- BrowseStoreStrategy storeStrategy = BrowseStoreStrategy.readUpdateCreate,
- BrowseStoreStrategy? otherStoresStrategy,
- BrowseLoadingStrategy loadingStrategy = BrowseLoadingStrategy.cacheFirst,
- bool useOtherStoresAsFallbackOnly = false,
- bool recordHitsAndMisses = true,
- Duration cachedValidDuration = Duration.zero,
- UrlTransformer? urlTransformer,
- BrowsingExceptionHandler? errorHandler,
- ValueNotifier<
TileLoadingInterceptorMap> ? tileLoadingInterceptor, - Map<
String, String> ? headers, - Client? httpClient,
Generate an FMTCTileProvider that only specifies this store
Prefer/migrate to the FMTCTileProvider.new constructor.
Tip
Minimize reconstructions of this provider by constructing it outside of
the build method of a widget wherever possible.
If this is not possible, because one or more properties depend on
inherited data (ie. via an InheritedWidget, Provider, etc.), define
and construct as many properties as possible outside of the build
method.
-
Manually constructing and initialising an
httpClientonce is much cheaper than the FMTCTileProvider's constructors doing it automatically on every construction (every rebuild), and allows a single connection to the server to be maintained, massively improving tile loading speeds. Also seehttpClient's documentation. -
Properties that use objects without a useful equality and hash code should always be defined once outside of the build method so that their identity (by identical) is not changed - for example,
httpClient,tileLoadingInterceptor,errorHandler, andurlTransformer. All properties comprise part of the hashCode & operator ==, which are used to form the Flutter session ImageCache key in the internal image provider (alongside the tile coordinates). This key should not change for a tile unless the configuration is actually changed meaningfully, as this will disrupt the session cache, and mean tiles may need to be fetched unnecessarily.
See the online documentation for an example of the recommended usage.
Implementation
@Deprecated(
'Use the `FMTCTileProvider` default constructor instead. '
'This will reduce internal codebase complexity and maximise external '
'flexibility, and works toward a potential future decentralised API '
'design. '
'This feature was deprecated in v10, and will be removed in a future '
'version.',
)
FMTCTileProvider getTileProvider({
BrowseStoreStrategy storeStrategy = BrowseStoreStrategy.readUpdateCreate,
BrowseStoreStrategy? otherStoresStrategy,
BrowseLoadingStrategy loadingStrategy = BrowseLoadingStrategy.cacheFirst,
bool useOtherStoresAsFallbackOnly = false,
bool recordHitsAndMisses = true,
Duration cachedValidDuration = Duration.zero,
UrlTransformer? urlTransformer,
BrowsingExceptionHandler? errorHandler,
ValueNotifier<TileLoadingInterceptorMap>? tileLoadingInterceptor,
Map<String, String>? headers,
Client? httpClient,
}) =>
FMTCTileProvider(
stores: {storeName: storeStrategy},
otherStoresStrategy: otherStoresStrategy,
loadingStrategy: loadingStrategy,
useOtherStoresAsFallbackOnly: useOtherStoresAsFallbackOnly,
recordHitsAndMisses: recordHitsAndMisses,
cachedValidDuration: cachedValidDuration,
urlTransformer: urlTransformer,
errorHandler: errorHandler,
tileLoadingInterceptor: tileLoadingInterceptor,
headers: headers,
httpClient: httpClient,
);