changeTileLayer method

Future<void> changeTileLayer({
  1. CustomTile? tileLayer,
})
inherited

Implementation

Future<void> changeTileLayer({CustomTile? tileLayer}) async {
  final urls = tileLayer?.urlsServers.first.toWeb();
  await promiseToFuture(
    interop.changeTileLayer(
      mapIdMixin,
      tileLayer != null && urls != null && urls.isNotEmpty
          ? CustomTileJs(
              url: urls.first,
              subDomains: urls.last,
              apiKey: tileLayer.keyApi != null
                  ? '?${tileLayer.keyApi!.key}=${tileLayer.keyApi!.value}'
                  : '',
              maxZoom: tileLayer.maxZoomLevel,
              minZoom: tileLayer.minZoomLevel,
              tileExtension: tileLayer.tileExtension,
              tileSize: tileLayer.tileSize,
            )
          : null,
    ),
  );
}