parseCommandData function Null safety

Command parseCommandData(
  1. String data
)

Implementation

Command parseCommandData(String data) {
  final payloadData = data.substring(4);
  final payload = jsonDecode(payloadData);
  payload['cmd'] = data.substring(0, 4);
  final ret = Command.fromJson(payload);
  ret.payload = payload;
  return ret;
}