3
這似乎有點麻煩有沒有更好的方法來找出文件或目錄存在?
var fileExists =
new File(path).existsSync() ||
new Directory(path).existsSync() ||
new Link(path).existsSync()
是否有更短或更好的辦法?
這似乎有點麻煩有沒有更好的方法來找出文件或目錄存在?
var fileExists =
new File(path).existsSync() ||
new Directory(path).existsSync() ||
new Link(path).existsSync()
是否有更短或更好的辦法?
較短的方法是
FileSystemEntity.typeSync(path) != FileSystemEntityType.NOT_FOUND
又見https://github.com/dart-lang/sdk/issues/2883#issuecomment-108317456