fromDynamic static method

CommandAck fromDynamic(
  1. dynamic map,
  2. String id,
  3. DateTime timestamp
)
override

Deserializes the command from a Map or a map-like object into the the proper data model. This will throw an exception if map is null.

Implementation

static CommandAck fromDynamic(
  dynamic map,
  String id,
  DateTime timestamp,
) {
  late CommandAck result;

  if (map == null) {
    throw Exception('[CommandAck.fromDynamic]: map is null');
  } else {
    result = CommandAck(
      commandId: map['commandId'],
      id: id,
      message: map['message'],
      response: CommandResponse.fromDynamic(map['response']),
      success:
          map['success'] == null ? null : JsonClass.parseBool(map['success']),
      timestamp: timestamp,
    );
  }

  return result;
}