listDirectory method

  1. @override
Future<List<FileSystemEntity>> listDirectory(
  1. String path
)
override

Lists the contents of the directory at the given path.

Implementation

@override
Future<List<FileSystemEntity>> listDirectory(String path) async {
  final fullPath = resolvePath(path);

  if (fullPath == rootDirectory) {
    return directoryMappings.values.map((dir) => Directory(dir)).toList();
  }

  final dir = Directory(fullPath);
  if (!await dir.exists()) {
    throw FileSystemException("Directory not found: $fullPath");
  }
  return dir.listSync();
}