KeyShapeCache class final
Builds and caches KeyMorphs by (rest, pressed, aspect).
Call prepare when a theme enters the feed's prefetch queue or when the keypad lays out, so painters only ever hit the cache. A miss in a paint builds synchronously (correct, but slower) and is counted in misses so tests can assert the commit frame never builds.
Constructors
- KeyShapeCache({int capacity = 256})
Properties
- capacity → int
-
Maximum entries kept (least recently used are evicted).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Entries cached.
no setter
- misses ↔ int
-
Lookups that had to build a morph.
getter/setter pair
- prepared ↔ int
-
Morphs built by prepare.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Drops every entry.
-
contains(
KeyGeometry rest, KeyGeometry pressed, double aspect) → bool - Whether the morph is cached.
-
lookup(
KeyGeometry rest, KeyGeometry pressed, double aspect) → KeyMorph - The cached morph, building it on a miss.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prepare(
KeyGeometry rest, KeyGeometry pressed, double aspect) → KeyMorph -
Builds (if needed) the morph for
rest→pressedataspect. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → KeyShapeCache
-
The app-wide cache.
final