getOrBuild method
Implementation
Path getOrBuild(StrokeNodeSnapshot node) {
if (node.points.isEmpty) {
return Path();
}
if (node.points.length == 1) {
return Path()
..addOval(Rect.fromCircle(center: node.points.first, radius: 0));
}
final geometryHash = _pointsHash(node.points);
final cached = _entries.remove(node.id);
if (cached != null && cached.geometryHash == geometryHash) {
_entries[node.id] = cached;
_debugHitCount += 1;
return cached.path;
}
final path = _buildStrokePath(node.points);
_entries[node.id] = _StrokePathEntryV2(
path: path,
geometryHash: geometryHash,
);
_debugBuildCount += 1;
_evictIfNeeded();
return path;
}