Node: cache the label

Computing the path spec again and again is apparently very very
expensive.
This commit is contained in:
Vishesh Handa
2020-09-26 00:36:58 +02:00
parent 4928143b31
commit 34630c671e

View File

@ -17,9 +17,14 @@ class Node {
double forceX = 0.0;
double forceY = 0.0;
String _label;
Node(this.note);
String get label => note.pathSpec();
String get label {
_label ??= note.pathSpec();
return _label;
}
@override
String toString() => "Node{$label, $x, $y}";