stateUpdate method
void
stateUpdate(
- RaceFullState newFullState,
- double standstillDurationBeforeStart,
- dynamic callback()
Implementation
void stateUpdate(RaceFullState newFullState, double standstillDurationBeforeStart, Function(double) callback) {
Iterable<bool> currentLaneAutostartPending = newFullState.laneStates.map((laneState) =>
laneState.extraState.trainingClassicRaceExtraState.autostartPending);
_timer.cancel();
_progress = 0.0;
callback(_progress);
if (currentLaneAutostartPending.any((element) => element) && !listEquals(oldLaneAutostartPending.toList(), currentLaneAutostartPending.toList())) {
_timer.start((elapsed) {
_progress = elapsed.inMilliseconds / standstillDurationBeforeStart;
callback(_progress);
}, 10);
}
oldLaneAutostartPending = currentLaneAutostartPending;
}