Asset class abstract

A representation of a file-based resource.

Provides a uniform interface for accessing and manipulating files regardless of their source or location. Each asset has a unique id, a shortUri for reference, and a complete uri for direct access.

Implementers

Constructors

Asset.new({required String id, required Uri shortUri, required File file})
Creates a new file-based asset.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
A unique identifier for this asset. it's typically a hash of the asset's shortUri.
no setter
packageName String?
Extracts the package name from the shortUri.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shortUri Uri
A shortened URI that may use package or asset schemes.
no setter
uri Uri
The complete URI that points to this asset.
no setter

Methods

existsSync() bool
Checks whether the asset exists.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readAsBytesSync() Uint8List
Reads the entire asset synchronously as a list of bytes.
readAsStringSync({Encoding encoding = utf8}) String
Reads the entire asset synchronously as a string.
safeDelete() → void
Safely deletes the asset if it exists.
toJson() Map<String, dynamic>
Converts this asset to a JSON representation.
toString() String
A string representation of this object.
inherited
uriWithExtension(String ext) Uri
Creates a new URI with the same path as this asset but with a different extension.

Operators

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