dart:检查目录是否存在

时间:2019-03-09 15:55:46

标签: dart flutter

在Dart中,想要检查目录是否存在,但不知道此目录的子字符串:

例如:

  

dir = Preview / 1552146038702.jpg.1--001--001.html.test.jpg

我尝试过:

io.Directory(await dir).exists().then((exist){

但在目录中我不知道 1--001--001.html

有什么主意吗?

3 个答案:

答案 0 :(得分:1)

这对我有用,希望我的回答有所帮助

final path = '/storage/emulated/0/Download';
final checkPathExistence = await Directory(path).exists();

答案 1 :(得分:0)

答案 2 :(得分:0)

不要忘记导入:

import 'dart:io';

相关问题