📅  最后修改于: 2022-03-11 15:02:20.530000             🧑  作者: Mango
Future> dirContents(Directory dir) {
var files = [];
var completer = Completer>();
var lister = dir.list(recursive: false);
lister.listen (
(file) => files.add(file),
// should also register onError
onDone: () => completer.complete(files)
);
return completer.future;
}