saCheck method

void saCheck (
  1. SamModel sm,
  2. SamReq req
)

The standard check handler to change a sym value in the SamHot table.

This is used by widget handlers to change values within the model.

It turns on the render request for the action so that the new value can be reflected.

Note This is used by widgets such as Checkbox where a Widget setState is required to trigger the appropriate update as the display does not change automatically when Checkbox is clicked.

Implementation

void saCheck(SamModel sm,SamReq req) {
  //log("sa-change called  sym=${req.stepParms.containsKey('actMap')}");
  String sym = req.stepParms['actMap']['sym'];
  bool val = req.stepParms['actMap']['value'];
  State state = req.stepParms['actMap']['atSrc'];
  CheckFunc execFunc = req.stepParms['actMap']['execFunc'];
  if(_bDebLog)log("sa-change called  sym=$sym val=$val");
  sm.setHot(sym,val);
  //req.render = true;
  // ignore: invalid_use_of_protected_member
  state.setState((){});
  if (execFunc != null) execFunc(sm,sym,val);
}