LocalDiskDriver class

Files in a folder on the device.

The root folder is resolved the first time the driver is used, then cached, so building a disk costs nothing. Writes go to a hidden temp file that is then renamed over the target, so a file is never seen half written. Listings skip those temp files and never follow symlinks.

Implemented types

Constructors

LocalDiskDriver(Future<String> root())
A driver whose root folder comes from root, e.g. a path_provider call.
LocalDiskDriver.at(String root)
A driver rooted at the absolute path root.

Properties

hashCode → int
The hash code for this object.
no setterinherited
root → Future<String>
The absolute root folder. Resolved once; a failed attempt is retried on the next call.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

absolutePath(String path) → Future<String?>
The absolute device path for path, or null when the driver has no files on the device (memory, the app bundle, remote storage).
override
copy(String from, String to) → Future<void>
Copies the file at from to to, replacing any file there.
override
createDirectory(String path) → Future<void>
Creates the folder at path and any missing parents.
override
delete(String path) → Future<bool>
Deletes the file at path. Returns false when there was none.
override
deleteDirectory(String path) → Future<bool>
Deletes the folder at path and everything in it. For the root (''), empties it instead. Returns false when there was no folder.
override
directoryExists(String path) → Future<bool>
Whether a folder exists at path. The root always exists.
override
fileExists(String path) → Future<bool>
Whether a file exists at path.
override
list(String directory, {bool recursive = false}) → Stream<DiskEntry>
The files and folders in directory, or in all its sub-folders when recursive. Entry paths are relative to the driver's root.
override
move(String from, String to) → Future<void>
Moves the file at from to to, replacing any file there.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String path) → Future<Uint8List>
The contents of the file at path.
override
readStream(String path) → Stream<List<int>>
The contents of the file at path, in chunks.
override
stat(String path) → Future<DiskEntry?>
What is at path, or null when nothing is.
override
toString() → String
A string representation of this object.
inherited
write(String path, List<int> bytes, {bool append = false}) → Future<void>
Writes bytes to path, creating parent folders.
override
writeStream(String path, Stream<List<int>> stream) → Future<void>
Writes a byte stream to path, replacing any file atomically.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

tempMarker → const String
Marks the hidden temp files written during an atomic replace.