resolve method

Future<Uint8List> resolve({
  1. required String name,
  2. required Uri uri,
  3. bool cache = true,
  4. Map<String, String>? headers,
})

Resolve the data

Implementation

Future<Uint8List> resolve({
  required String name,
  required Uri uri,
  bool cache = true,
  Map<String, String>? headers,
}) async {
  if (cache && await contains(name)) {
    return (await get(name))!;
  }

  final bytes = await _download(uri, headers: headers);

  if (bytes == null) {
    throw FlutterError('Unable to download $uri');
  }

  if (cache) {
    await add(name, bytes);
  }

  return bytes;
}