getDecodedImage method

Future<Image?> getDecodedImage(
  1. String url
)

Returns decoded image, fetching and caching if necessary.

Implementation

Future<ui.Image?> getDecodedImage(String url) async {
  final cached = _strategy.get(url);
  if (cached?.image != null) {
    _log('Decoded cache hit: $url');
    return cached!.image;
  }

  if (_inFlight.containsKey(url)) {
    _log('Joining ongoing fetch: $url');
    return (await _inFlight[url])?.image;
  }

  return _fetchAndCache(url)?.then((entry) => entry?.image);
}