getImage method

Future<Uint8List?> getImage(
  1. String url, {
  2. Map<String, String>? headers,
  3. String? cacheKey,
  4. bool forceDownload = false,
})

Implementation

Future<Uint8List?> getImage(
    String url, {
      Map<String, String>? headers,
      String? cacheKey,
      bool forceDownload = false,
    }) async {
  final id = _id(url, cacheKey);
  if (!forceDownload) {
    final cached = await getCachedImage(url, cacheKey: id);
    if (cached != null) return cached;
  }
  return downloadAndCacheImage(url, headers: headers, cacheKey: id);
}