listFolders function
This function return list of folders of type String , not full paths Directory.
e.g: listFolders(Directory("/")) = root, usr, var, proc, mnt ...
hidden
: this parameter excludes folders starts with " . "excludedFolders
: this parameter excludes folders from the result- sortedBy:
Sorting
- bool reversed: in case parameter sortedBy is used
- examples:
"Android", "Download", "DCIM", ....
Implementation
Future<List<String>> listFolders(Directory path,
{List<String>? excludedFolders,
List<String>? excludedPaths,
bool excludeHidden: false,
followLinks: false,
FlutterFileUtilsSorting? sortedBy,
bool reversed: false}) async {
List<String> folders = (await listDirectories(path,
excludeHidden: excludeHidden,
followLinks: false,
reversed: reversed,
sortedBy: sortedBy))
.map((Directory directory) => pathlib.split(directory.absolute.path).last)
.toList();
return folders;
}