getDirectories method

Future<List<Directory>> getDirectories(
  1. String location
)

Implementation

Future<List<Directory>> getDirectories (String location) async {
  List<Directory> directories = [];
  directories.add(Directory(join(Directory.current.path, location)));

  Stream<FileSystemEntity> files = Directory(join(Directory.current.path, location)).list(recursive: true);

  await files.forEach((element) {
    if (element is Directory) {
      directories.add(element);
    }
  });

  return directories;
}