DiagramImageCache class final
Shared asynchronous image resolver for Canvas-painted image shapes.
The cache is editor-owned rather than shape-owned, so camera changes and unrelated document revisions never restart image loading.
Constructors
-
DiagramImageCache({ImageProvider<
Object> provider(DiagramImageSource)?, int maximumConcurrentLoads = DiagramImageConfiguration.defaultMaximumConcurrentLoads, int? maximumDecodedBytes, int retentionBytes = DiagramImageConfiguration.defaultRetentionBytes, Duration loadTimeout = DiagramImageConfiguration.defaultLoadTimeout})
Properties
- activeImageCount → int
-
no setter
- decodedPixelBytes → int
-
Estimated RGBA pixel storage, excluding Flutter's global image cache,
encoded bytes, retained pictures, decoder buffers and GPU overhead.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- loadTimeout → Duration
-
no setter
- maximumConcurrentLoads → int
-
no setter
- maximumDecodedBytes → int?
-
Optional admission limit for decoded RGBA bytes retained by this cache.
Excludes decoder peaks, global provider caches, pictures and owned clones.
Exceeding it fails the resource; existing borrowed handles are not evicted.
final
- pendingImageCount → int
-
no setter
-
provider
→ ImageProvider<
Object> Function(DiagramImageSource)? -
final
- queuedImageCount → int
-
no setter
- retainedImageCount → int
-
Decoded resources retained by this editor, deduplicated by source URI.
no setter
- retentionBytes → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
configure(
DiagramImageConfiguration configuration) → void - Applies validated policy without dropping decoded images or active loads. Active loads retain their original deadlines; new loads use the new one.
-
dispose(
) → void - Discards any resources used by the object.
-
errorFor(
DiagramImageSource source) → Object? -
imageFor(
DiagramImageSource source) → Image? -
load(
DiagramImageSource source) → Future< Image> - Waits for the same resource used by canvas painting. The returned image is borrowed: the cache owns it and callers must not dispose it.
-
loadOwned(
DiagramImageSource source) → Future< Image> - Returns an independently owned handle. The caller must dispose it. Ownership is established before completing the future, so cache release or disposal cannot invalidate the handle while its continuation is pending.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
release(
DiagramImageSource source) → void - Releases a completed image. Borrowers must finish or clone their handles first. Flutter's provider cache and recorded pictures may retain images.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
retry(
DiagramImageSource source) → bool - Explicitly retries a failed resource. Successful or active loads are left intact; repainting alone never causes an automatic retry loop.
-
revisionFor(
DiagramImageSource source) → int -
toString(
) → String -
A string representation of this object.
inherited
-
trim(
{required Set< String> retaining, required void beforeRelease(Set<String> )}) → void -
Called between paints with the entire viewport's required URI set.
Borrowed handles must not escape the paint turn. Drop dependent pictures
through
beforeReleasebefore the selected cache handles are disposed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited