common/io library

Functions

copyFile(String from, String to, {bool recursive = false}) → void
Copies a file from the source file to the destination file.
createTempDir(String base, [String? prefix]) String
Creates a temp directory in base, whose name will be prefix with characters appended to it to make a unique name.
deleteEntry(String path) → void
Deletes whatever's at path, whether it's a file, directory, or symlink.
Deletes file if it's a symlink.
dirExists(String dir) bool
Returns whether dir exists on the file system.
ensureDir(String dir) String
Ensures that dir and all its parent directories exist.
entryExists(String path) bool
Determines if a file or directory exists at path.
fileExists(String file) bool
Returns whether file exists on the file system.
linkExists(String link) bool
Returns whether link exists on the file system.
readTextFile(String file) String
Reads the contents of the text file file.
readTextFileAsync(String file) Future<String>
Reads the contents of the text file file.
writeTextFile(String file, String contents, {bool dontLogContents = false, Encoding encoding = utf8, bool recursive = false}) → void
Creates file and writes contents to it.
writeTextFileAsync(String file, String contents, {bool dontLogContents = false, Encoding encoding = utf8, bool recursive = false}) Future<void>
Creates file and writes contents to it.

Exceptions / Errors

CliException
IOException