fromDynamic static method

StartScreenshotStreamCommand 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 StartScreenshotStreamCommand fromDynamic(
  dynamic map,
  String id,
  DateTime timestamp,
) {
  late StartScreenshotStreamCommand result;

  if (map == null) {
    throw Exception(
        '[StartScreenshotStreamCommand.fromDynamic]: map is null');
  } else {
    result = StartScreenshotStreamCommand(
      id: id,
      interval: JsonClass.parseDurationFromMillis(map['interval']) ??
          const Duration(seconds: 5),
      timestamp: timestamp,
    );
  }

  return result;
}