VectorTileLayer constructor

VectorTileLayer({
  1. Key? key,
  2. required TileProviders tileProviders,
  3. required Theme theme,
  4. Duration fileCacheTtl = defaultCacheTtl,
  5. int memoryTileCacheMaxSize = defaultTileCacheMaxSize,
  6. int memoryTileDataCacheMaxSize = defaultTileDataCacheMaxSize,
  7. int fileCacheMaximumSizeInBytes = defaultCacheMaxSize,
  8. int textCacheMaxSize = defaultTextCacheMaxSize,
  9. int concurrency = defaultConcurrency,
  10. TileOffset tileOffset = TileOffset.DEFAULT,
  11. int maximumTileSubstitutionDifference = defaultMaxTileSubstitutionDifference,
  12. Theme? backgroundTheme,
  13. bool showTileDebugInfo = false,
  14. bool logCacheStats = false,
  15. VectorTileLayerMode layerMode = VectorTileLayerMode.raster,
  16. double? maximumZoom,
  17. Duration tileDelay = const Duration(milliseconds: 0),
})

Implementation

VectorTileLayer(
    {Key? key,
    required this.tileProviders,
    required this.theme,
    this.fileCacheTtl = defaultCacheTtl,
    this.memoryTileCacheMaxSize = defaultTileCacheMaxSize,
    this.memoryTileDataCacheMaxSize = defaultTileDataCacheMaxSize,
    this.fileCacheMaximumSizeInBytes = defaultCacheMaxSize,
    this.textCacheMaxSize = defaultTextCacheMaxSize,
    this.concurrency = defaultConcurrency,
    this.tileOffset = TileOffset.DEFAULT,
    this.maximumTileSubstitutionDifference =
        defaultMaxTileSubstitutionDifference,
    this.backgroundTheme,
    this.showTileDebugInfo = false,
    this.logCacheStats = false,
    this.layerMode = VectorTileLayerMode.raster,
    this.maximumZoom,
    this.tileDelay = const Duration(milliseconds: 0)})
    : super(key: key) {
  assert(concurrency >= 0 && concurrency <= 100);
  final providers = theme.tileSources
      .map((source) => tileProviders.tileProviderBySource[source])
      .whereType<VectorTileProvider>();
  assert(
      providers.isNotEmpty,
      '''
tileProviders must provide at least one provider that matches the given theme.
Usually this is an indication that TileProviders in the code doesn't match the sources
required by the theme.
The theme uses the following sources: ${theme.tileSources.toList().sorted().join(', ')}.
'''
          .trim());
  assert(
      maximumTileSubstitutionDifference >= 0 &&
          maximumTileSubstitutionDifference <= 3,
      'maximumTileSubstitutionDifference must be >= 0 and <= 3');
  assert(memoryTileDataCacheMaxSize >= 0 && memoryTileDataCacheMaxSize < 100);
}