ThumbnailCache class
In-memory LRU of XAssetThumbnails keyed by (assetId, sizePx).
Telegram's PHCachingImageManager already caches on the native
side; this Dart-side LRU keeps repeated rebuilds (scroll
off-screen → back on) from re-encoding.
Constructors
- ThumbnailCache({int capacity = 200})
-
Creates a cache of
capacitythumbnails.
Properties
- capacity → int
-
Thumbnails kept before the least recently used is dropped.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
ringSpringPlayed
→ Set<
String> -
Asset IDs whose selection-ring entry spring (scale 0.2 → 1.0 +
alpha) has already played in this picker session. Mirrors
telegram-iOS's
if self.checkNode == nilgate onMediaPickerGridItem.swift:261— the spring runs once per asset, not once per cell mount, so a tile that scrolls out of the GridView's cache and back doesn't replay it.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Drops every thumbnail, pending load and played ring.
-
load(
String assetId, {required int sizePx}) → Future< XAssetThumbnail> - Fetch (cache hit, in-flight share, or new request). Repeated calls for the same key while the future is in flight share the same future so we don't hit the platform channel twice.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peek(
String assetId, int sizePx) → XAssetThumbnail? - The cached thumbnail, marked as just used; absent on a miss.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited