getImage method

  1. @override
ImageProvider<Object> getImage(
  1. TileCoordinates coordinates,
  2. TileLayer options
)

Retrieve a tile as an image, based on its coordinates and the TileLayer

Usually redirects to a custom ImageProvider, with one input depending on getTileUrl.

For many implementations, this is the only method that will need implementing.


Does not support cancelling loading tiles, unlike getImageWithCancelLoadingSupport. For this method to be called instead of that, supportsCancelLoading must be false (default).

Implementation

@override
ImageProvider getImage(TileCoordinates coordinates, TileLayer options) =>
    FMTCImageProvider(
      provider: this,
      options: options,
      coords: coordinates,
      startedLoading: () => _tilesInProgress[coordinates] = Completer(),
      finishedLoadingBytes: () {
        _tilesInProgress[coordinates]?.complete();
        _tilesInProgress.remove(coordinates);
      },
    );