directoryEntries method

  1. @override
List<String> directoryEntries(
  1. String directory
)
override

The names of the entries directly under directory; empty when it does not exist or cannot be read.

Implementation

@override
List<String> directoryEntries(String directory) {
  final dir = Directory(directory);
  if (!dir.existsSync()) return const [];
  try {
    return [
      for (final entity in dir.listSync(followLinks: true))
        entity.path.split(Platform.pathSeparator).last,
    ];
  } on FileSystemException {
    return const [];
  }
}