AssetDiskDriver class

The app bundle, read-only.

Files are listed through AssetManifest, so only assets declared in pubspec.yaml appear. Paths are asset keys, e.g. assets/images/logo.png; the assets disk adds the assets/ prefix for you.

Implemented types

Constructors

AssetDiskDriver({AssetBundle? bundle})
A driver over bundle, or rootBundle when null.

Properties

bundle → AssetBundle
The bundle files are read from.
no setter
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).
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