documents method

Future<List<String>> documents()

Retrieves a list of all cache keys.

Returns a list of strings, where each string is a cache key. Returns an empty list on web platform.

Implementation

Future<List<String>> documents() async {
  if (!isAvailable) return [];

  if (!await _cacheDirectory!.exists()) return [];

  final List<FileSystemEntity> entities = await _cacheDirectory!
      .list()
      .toList();
  return entities
      .whereType<File>()
      .map((file) => file.path.split('/').last)
      .toList();
}