有没有更好的方法来找出文件或目录是否存在?
Is there a better way to find out of a file or directory exists?
这个好像有点麻烦
var fileExists =
new File(path).existsSync() ||
new Directory(path).existsSync() ||
new Link(path).existsSync()
是否有更短或更好的方法?
更短的方法是
import 'dart:io';
FileSystemEntity.typeSync(path) != FileSystemEntityType.notFound
另见 https://github.com/dart-lang/sdk/issues/2883#issuecomment-108317456
这个好像有点麻烦
var fileExists =
new File(path).existsSync() ||
new Directory(path).existsSync() ||
new Link(path).existsSync()
是否有更短或更好的方法?
更短的方法是
import 'dart:io';
FileSystemEntity.typeSync(path) != FileSystemEntityType.notFound
另见 https://github.com/dart-lang/sdk/issues/2883#issuecomment-108317456