DVImageVariants class
The widths images are resized to, and what can be resized.
Read from dartvel.images in pubspec.yaml by the build, which adds what
it knows about the build itself -- whether a server answers
dvImageEndpointPath, and which images it wrote variants of -- and hands
the whole of it to the application. An application built without it has
no variants: isActive is false and every image is fetched as it is.
Constructors
Properties
-
assetWidths
→ Map<
String, int> -
The width of each image the build wrote variants of, by the path the
site serves it at (
assets/assets/hero.png). A variant as wide as the image or wider is never written, so the image itself is used instead.final - endpoint → bool
-
Whether a server answers dvImageEndpointPath: true on a web-server
build, false on a static one, where there is nothing to answer it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
Whether this build has any variants at all.
no setter
- quality → int
-
For lossy formats; 1 to 100.
final
-
remoteHosts
→ List<
String> -
Hosts whose images the server will fetch and resize.
*.example.comallows the subdomains of example.com and not example.com itself.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
widths
→ List<
int> -
Ascending. A request for any other width is refused.
final
Methods
-
allowsHost(
String host) → bool -
Whether the server may fetch images from
host. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
snap(
double devicePixels) → int -
The smallest configured width covering
devicePixels, or the largest. -
toDartDefine(
) → String -
toJson as a
--dart-definevalue: base64url, because the flutter tool splits a define's value at commas and a JSON object is full of them. -
toJson(
) → Map< String, Object?> -
toString(
) → String -
A string representation of this object.
inherited
-
variantUrl(
String src, double devicePixels) → String? -
Where
srcdrawndevicePixelswide is fetched from, or null to fetchsrcitself.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromJson(
Object? json) → DVImageVariants - What toJson wrote, as a map, as its JSON text or as toDartDefine's base64url. Anything unreadable is a build with no variants, never an exception: this runs as the application starts.
-
parse(
Object? section) → ({List< String> problems, DVImageVariants variants}) -
dartvel.imagesfrom pubspec.yaml, and what in it was not accepted.