dirContents method
Implementation
Future<List<FileSystemEntity>> dirContents(Directory dir) {
if(!dir.existsSync()) return Future.value([]);
var files = <FileSystemEntity>[];
var completer = Completer<List<FileSystemEntity>>();
var lister = dir.list(recursive: true);
lister.listen((file) => files.add(file),
// should also register onError
onDone: () => completer.complete(files));
return completer.future;
}