FileSystemShortcuts extension
Methods
-
atomicMove(String source, String target)
→ Future<void>
-
Moves
source
to target
in-place if the underlying file system supports it. If target
exists, it is first removed. If source == target
, this operation does nothing. This may be
used to move a file or a directory.
-
copy(String source, String target)
→ Future<FileSystemEntity>
-
-
createDirectory(dynamic path, {bool recursive = false})
→ Future<Directory>
-
Creates the directory if it doesn't exist.
-
createDirectorySync({bool recursive = false})
→ void
-
Synchronously creates the directory if it doesn't exist.
-
createLink(dynamic path, {bool recursive = false})
→ Future<Link>
-
Creates a symbolic link in the file system.
-
createLinkSync(dynamic path, {bool recursive = false})
→ void
-
Creates a symbolic link in the file system.
-
delete(String path, {bool mustExist = false})
→ Future<void>
-
Deletes the FileSystemEntity reference by
path
.
-
deleteSync(String path, {bool mustExist = false})
→ void
-
Synchronously deletes the FileSystemEntity reference by
path
.
-
entity(String path)
→ Future<FileSystemEntity?>
-
Returns a reference to a FileSystemEntity at
path
.
-
entitySync(String path)
→ FileSystemEntity?
-
Synchronously returns a reference to a FileSystemEntity at
path
.
-
exists(String path)
→ Future<bool>
-
Checks whether the file system entity with this
path
exists.
-
existsSync(String path)
→ bool
-
Synchronously checks whether the file system entity with this
path
exists.
-
isCivilized(String path)
→ Future<bool>
-
Returns true if file streams can be manipulated independently of their
paths. This is typically true for systems like Mac, Unix, and Linux that
use inodes in their file system interface. It is typically false on
Windows.
-
open(dynamic path, {FileMode mode = FileMode.read, bool recursive = false})
→ Future<FileHandle>
-
Creates a
FileHandle
to handle path
.
-
openAppendingSink(dynamic path, {bool recursive = false})
→ Future<Sink>
-
-
openSink(dynamic path, {int position = 0, bool recursive = false})
→ Future<Sink>
-
-
openSource(dynamic path, {int position = 0})
→ Future<Source>
-
-
read<T>(String path, FutureOr<T> block(BufferedSource source), [int? start, int? end])
→ Future<T>
-
Creates a source to read
path
, executes block
to read it, and then closes the
source. This is a compact way to read the contents of a file.
-
sink(String path, {FileMode mode = FileMode.write, bool recursive = false})
→ Future<Sink>
-
Creates a
Sink
that writes bytes to path
from beginning to end. If path
already exists it
will be replaced with the new data.
-
source(String path, [int? start, int? end])
→ Future<Source>
-
Creates a source that reads the bytes of
path
from beginning to end.
-
write<T>(String path, FutureOr<T> block(BufferedSink sink), {FileMode mode = FileMode.write, bool recursive = false})
→ Future<T>
-
Creates a sink to write
path
, executes block
to write it, and then closes the sink.
This is a compact way to write a file.