Reputation: 4163
In Dart would like to check if a directory exist but without knowing a substring of this directory :
eg :
dir = preview/1552146038702.jpg.1--001--001.html.test.jpg
I tried :
io.Directory(await dir).exists().then((exist){
but in the dir I don't know 1--001--001.html
Any idea?
Upvotes: 11
Views: 13207
Reputation: 2308
This works for me, hope my answer help
final path = '/storage/emulated/0/Download';
final checkPathExistence = await Directory(path).exists();
Upvotes: 8
Reputation: 657446
Directory.exists()
provides this information
bool exists = await Directory(path).exists();
Upvotes: 22