Skip to content

Instantly share code, notes, and snippets.

@samiy-xx
Last active December 31, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samiy-xx/8038676 to your computer and use it in GitHub Desktop.
Save samiy-xx/8038676 to your computer and use it in GitHub Desktop.
blaa
import 'dart:io';
void main() {
getFiles().then((List<String> paths) {
print(paths[0]);
});
}
Future<List<String>> getFiles() {
Completer<List<String>> c = new Completer<List<String>>();
String Path = "../../MaterialEditor/web/Images/";
List<String> Files = new List<String>();
var d = new Directory(Path);
d.exists().then((bool exists) {
if (!exists)
return;
d.list().toList().then((List<FileSystemEntity> entities) {
entities.forEach((FileSystemEntity entity) {
if (entity is File) {
Files.add(entity.path.substring(Path.length));
}
}
c.complete(Files);
});
});
});
return c.future;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment