AssetImplementation class
A concrete, immutable implementation of the Asset interface.
This class represents a single asset in the system, containing the file path, file name, package name, and binary content.
Typically used in scenarios where reflective or dynamic loading of files and packages is required.
Example
final asset = AssetImplementation(
filePath: 'lib/resources/logo.png',
fileName: 'logo.png',
packageName: 'my_package',
contentBytes: await File('lib/resources/logo.png').readAsBytes(),
);
print(asset.fileName); // logo.png
- Inheritance
-
- Object
- ResourceDeclaration
- Asset
- AssetImplementation
- Mixed-in types
- Available extensions
Constructors
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
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode
, andtoString
.override -
getContentAsString(
) → String -
Available on Asset, provided by the AssetExtension extension
Extension methods for Asset objects. -
getContentBytes(
) → Uint8List -
Returns the binary content of the asset (same as
_contentBytes
).inherited -
getFileName(
) → String -
Returns the name of the file (same as
_fileName
).inherited -
getFilePath(
) → String -
Returns the full path to the file (same as
_filePath
).inherited -
getPackageName(
) → String? -
Returns the name of the originating package (same as
_packageName
).inherited -
getUniqueName(
) → String -
Returns a unique name for the asset, combining the package name and file name.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object> -
Serializes this resource to a JSON-encodable map.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited