这看起来有点麻烦
var fileExists =
new File(path).existsSync() ||
new Directory(path).existsSync() ||
new Link(path).existsSync()
Run Code Online (Sandbox Code Playgroud)
有更短或更好的方式吗?
Gün*_*uer 13
更简短的方法是
import 'dart:io';
FileSystemEntity.typeSync(path) != FileSystemEntityType.notFound
Run Code Online (Sandbox Code Playgroud)
另见https://github.com/dart-lang/sdk/issues/2883#issuecomment-108317456
| 归档时间: |
|
| 查看次数: |
2554 次 |
| 最近记录: |