sortByName property
Future<List<FileSystemEntity> >
get
sortByName
Implementation
Future<List<FileSystemEntity>> get sortByName async {
final List<Directory> dirs = [];
final List<File> files = [];
for (final entity in this) {
if (entity is Directory) {
dirs.add(entity);
} else if (entity is File) {
files.add(entity);
}
}
dirs.sort((a, b) => a.path.toLowerCase().compareTo(b.path.toLowerCase()));
files.sort((a, b) => a.path.toLowerCase().compareTo(b.path.toLowerCase()));
return [...dirs, ...files];
}