build method
override
Declares this node's children and behavior.
Runs once on mount, and again on every rebuild.
super.build() is required, as skipping it drops whatever the superclass
declared.
Implementation
@override
void build() {
super.build();
_target.resolve();
tick((dt) {
final position = target!.position;
final offset = destination - position;
final distance = offset.length;
final step = speed * dt;
if (distance <= step) {
position.setFrom(destination);
if (!_arrived) {
_arrived = true;
onFinish.emit();
}
} else {
position.addScaled(offset, step / distance);
_arrived = false;
}
});
}