PathCache class
Caches pre-computed ui.Path objects to avoid rebuilding them on every
paint() call when the underlying data has not changed.
Usage in a painter:
final path = pathCache.getOrBuild('line_series_0_${hashCode}', () {
final p = ui.Path();
// ... build the path from data ...
return p;
});
canvas.drawPath(path, strokePaint(color, 2));
Constructors
- PathCache()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
no setter
- stats → ChartObjectCacheStats
-
no setter
Methods
-
clear(
{bool resetMetrics = true}) → void -
getOrBuild(
String key, Path builder()) → Path -
Returns cached path for
key, or builds and caches it viabuilder. -
invalidate(
String key) → void - Invalidate a specific key (call when data changes).
-
invalidatePrefix(
String prefix) → void -
Invalidate all keys with a given prefix (e.g., invalidate all paths for
a series:
invalidatePrefix('series_0_')). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetStats(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited