handleLogReq method

void handleLogReq (
  1. covariant MissileSite sm,
  2. SamReq req
)

Write log data to the Logger widget.

The covariant keyword is used to inform Dart that sm will be a subclass of SamModel and not SamModel specifically.

We are able to pass custom data in the request using the SamReq.stepParms map.

In this case we color code the log messages according to the source of the log data.

Implementation

void handleLogReq(covariant MissileSite sm, SamReq req) {
  String msg = req.stepParms['msg'];
  assert(log("handleLogReq $sm $req msg=$msg"));
  Bank src = req.stepParms['src'];
  Text text = Text(msg,style:TextStyle(color:_colMap[src._missType]));
  sm.logger.addLogLine(text);
}