Last active
December 31, 2015 20:09
-
-
Save samiy-xx/8038676 to your computer and use it in GitHub Desktop.
blaa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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