ResourceDeclaration class abstract
Abstract base class for declarations of external resources in reflection systems.
Represents metadata about external resources like:
- Asset files (images, translations, etc.)
- Native platform libraries
- Web resources
- Database schemas
{@template resource_declaration_features}
Key Features
- JSON serialization support
- Standardized toString() representation
- Base for resource-specific declarations
Implementations
Typically extended by:
AssetDeclaration
for bundled filesNativeLibraryDeclaration
for platform librariesWebResourceDeclaration
for network assets
Example Implementation
class ImageDeclaration extends ResourceDeclaration {
final String path;
final int width;
final int height;
const ImageDeclaration(this.path, this.width, this.height);
@override
Map<String, Object> toJson() => {
'type': 'image',
'path': path,
'dimensions': {'width': width, 'height': height}
};
}
{@endtemplate}
Constructors
- ResourceDeclaration()
-
Creates a new resource declaration instance.
const
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
-
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.
-
toString(
) → String -
Standard string representation of this resource.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited