cached method

Future<bool> cached(
  1. String url
)

Check the given url is cached or not.

Implementation

Future<bool> cached(String url) async {
  temporaryDirectory ??= await getTemporaryDirectory();
  final hash = md5.convert(utf8.encode(url)).toString();
  String filePath;
  if (prefix != null) {
    filePath = path.join(temporaryDirectory!.path, identifier, prefix, hash);
  } else {
    filePath = path.join(temporaryDirectory!.path, identifier, hash);
  }
  final file = File(filePath);
  return file.exists();
}