DiskDriver class abstract

The primitive operations a storage backend implements.

Every path a driver receives has already been checked and normalized by Disk: /-separated, relative to the driver's root, with no . or .. segments and no leading or trailing slash. The root itself is ''. A driver only moves bytes; path rules, read-only disks, prefixes, JSON, MIME types and checksums all live in Disk.

To check a new driver, run it through testDiskDriver() from Nylo's testing library.

Implementers

Constructors

DiskDriver()

Properties

hashCode → int
The hash code for this object.
no setterinherited
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).
copy(String from, String to) → Future<void>
Copies the file at from to to, replacing any file there.
createDirectory(String path) → Future<void>
Creates the folder at path and any missing parents.
delete(String path) → Future<bool>
Deletes the file at path. Returns false when there was none.
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.
directoryExists(String path) → Future<bool>
Whether a folder exists at path. The root always exists.
fileExists(String path) → Future<bool>
Whether a file exists at path.
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.
move(String from, String to) → Future<void>
Moves the file at from to to, replacing any file there.
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.
readStream(String path) → Stream<List<int>>
The contents of the file at path, in chunks.
stat(String path) → Future<DiskEntry?>
What is at path, or null when nothing is.
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.
writeStream(String path, Stream<List<int>> stream) → Future<void>
Writes a byte stream to path, replacing any file atomically.

Operators

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