get method

  1. @override
TilePicture? get(
  1. Tile tile
)

Returns the requested picture or null if the picture is not available.

todo it may make sense to return a clone and dispose that clone at the consumer. The cache may evict an image at any time even if it is still used by the consumer.

Implementation

@override
TilePicture? get(Tile tile) {
  try {
    return _cache.get(tile);
  } catch (error) {
    // Exception: Cannot get a value from a producer since the value is a future and the get() method is synchronously
    // a the procuder is still in progress, return null
    return null;
  }
}