napPrepReady method
- covariant Rocket sm,
- SamReq req
Handler when model enters RK.ssReady state.
The counter ctr
is and the timer built if it
does not exist. This is an example of mutating non-SamHot
values
inside the SamModel.present
execution scope.
The Flutter timer used by this app automatically runs the first time but needs to be reset every time it expires. Unfortunately, this makes the logic not perfectly DRY.
Implementation
void napPrepReady(covariant Rocket sm,SamReq req) {
if(sm.bLog)log("fnPrepReady");
sm.setHot("ctr",10);
if (sm._timer == null) sm._timer = RestartableTimer(sm._timerDuration,(){decrementCtr(sm);});
}