getTileProvider method

  1. @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({
  1. BrowseStoreStrategy storeStrategy = BrowseStoreStrategy.readUpdateCreate,
  2. BrowseStoreStrategy? otherStoresStrategy,
  3. BrowseLoadingStrategy loadingStrategy = BrowseLoadingStrategy.cacheFirst,
  4. bool useOtherStoresAsFallbackOnly = false,
  5. bool recordHitsAndMisses = true,
  6. Duration cachedValidDuration = Duration.zero,
  7. UrlTransformer? urlTransformer,
  8. BrowsingExceptionHandler? errorHandler,
  9. ValueNotifier<TileLoadingInterceptorMap>? tileLoadingInterceptor,
  10. Map<String, String>? headers,
  11. 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 httpClient once 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 see httpClient'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, and urlTransformer. 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,
    );