get method

  1. @override
Future<FileSystemEntity?> get(
  1. String key
)
override

Retrieves the file associated with the given key, or null if not present or does not exist.

Updates hit/miss statistics accordingly. The operation is thread-safe.

Implementation

@override
Future<FileSystemEntity?> get(String key) async {
  assert(key.isNotEmpty, 'key must not be empty');
  return await lock.synchronized(() async {
    File? file = map[key] as File?;
    if (file != null && await file.exists()) {
      hitCount++;
      return file;
    }
    missCount++;
    return null;
  });
}