DVImage class
An image held by a model field.
Models are serialized to JSON for persistence, transport and generated clients, so an image field has to be a value rather than a widget. Rendering belongs to the UI layer, which reads source and reference.
Constructors
- DVImage({required DVImageSource source, required String reference, String? alt, int? width, int? height})
-
const
- DVImage.asset(String assetKey, {String? alt, int? width, int? height})
-
const
- DVImage.file(String path, {String? alt, int? width, int? height})
-
const
- DVImage.network(String url, {String? alt, int? width, int? height})
-
const
- DVImage.stored(String key, {String? alt, int? width, int? height})
-
const
Properties
- alt → String?
-
Alternative text. Generated pages use it for accessibility, and SEO uses
it for the OG image description.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- height → int?
-
Intrinsic height in pixels, when known.
final
- reference → String
-
The URL, asset key, or file path, depending on source.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → DVImageSource
-
How reference should be resolved.
final
- width → int?
-
Intrinsic width in pixels, when known. Generated pages use it to reserve
space, which avoids layout shift before the image loads.
final
Methods
-
copyWith(
{DVImageSource? source, String? reference, String? alt, int? width, int? height}) → DVImage -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override