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();
tick((dt) {
if (dt <= 0 || !dt.isFinite) return;
_window.add(dt);
_sum += dt;
if (_window.length > windowSize) {
_sum -= _window.first;
_window.removeAt(0);
}
final fps = _window.length / _sum;
this.fps = fps.isFinite ? fps : 0;
final rounded = this.fps.round();
if (rounded != _last) {
_last = rounded;
onFpsChange.emit(rounded);
}
});
}