fromJson static method

CallFrameRecordingFrameReadyEvent? fromJson(
  1. dynamic value
)

Returns a new CallFrameRecordingFrameReadyEvent instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static CallFrameRecordingFrameReadyEvent? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      assert(json.containsKey(r'call_cid'),
          'Required key "CallFrameRecordingFrameReadyEvent[call_cid]" is missing from JSON.');
      assert(json[r'call_cid'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[call_cid]" has a null value in JSON.');
      assert(json.containsKey(r'captured_at'),
          'Required key "CallFrameRecordingFrameReadyEvent[captured_at]" is missing from JSON.');
      assert(json[r'captured_at'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[captured_at]" has a null value in JSON.');
      assert(json.containsKey(r'created_at'),
          'Required key "CallFrameRecordingFrameReadyEvent[created_at]" is missing from JSON.');
      assert(json[r'created_at'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[created_at]" has a null value in JSON.');
      assert(json.containsKey(r'egress_id'),
          'Required key "CallFrameRecordingFrameReadyEvent[egress_id]" is missing from JSON.');
      assert(json[r'egress_id'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[egress_id]" has a null value in JSON.');
      assert(json.containsKey(r'session_id'),
          'Required key "CallFrameRecordingFrameReadyEvent[session_id]" is missing from JSON.');
      assert(json[r'session_id'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[session_id]" has a null value in JSON.');
      assert(json.containsKey(r'track_type'),
          'Required key "CallFrameRecordingFrameReadyEvent[track_type]" is missing from JSON.');
      assert(json[r'track_type'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[track_type]" has a null value in JSON.');
      assert(json.containsKey(r'type'),
          'Required key "CallFrameRecordingFrameReadyEvent[type]" is missing from JSON.');
      assert(json[r'type'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[type]" has a null value in JSON.');
      assert(json.containsKey(r'url'),
          'Required key "CallFrameRecordingFrameReadyEvent[url]" is missing from JSON.');
      assert(json[r'url'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[url]" has a null value in JSON.');
      assert(json.containsKey(r'users'),
          'Required key "CallFrameRecordingFrameReadyEvent[users]" is missing from JSON.');
      assert(json[r'users'] != null,
          'Required key "CallFrameRecordingFrameReadyEvent[users]" has a null value in JSON.');
      return true;
    }());

    return CallFrameRecordingFrameReadyEvent(
      callCid: mapValueOfType<String>(json, r'call_cid')!,
      capturedAt: mapDateTime(json, r'captured_at', r'')!,
      createdAt: mapDateTime(json, r'created_at', r'')!,
      egressId: mapValueOfType<String>(json, r'egress_id')!,
      sessionId: mapValueOfType<String>(json, r'session_id')!,
      trackType: mapValueOfType<String>(json, r'track_type')!,
      type: mapValueOfType<String>(json, r'type')!,
      url: mapValueOfType<String>(json, r'url')!,
      users: UserResponse.mapFromJson(json[r'users']),
    );
  }
  return null;
}