fromJson static method

CreateEventRequest? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static CreateEventRequest? 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'account_id'), 'Required key "CreateEventRequest[account_id]" is missing from JSON.');
      assert(json[r'account_id'] != null, 'Required key "CreateEventRequest[account_id]" has a null value in JSON.');
      assert(json.containsKey(r'event'), 'Required key "CreateEventRequest[event]" is missing from JSON.');
      assert(json[r'event'] != null, 'Required key "CreateEventRequest[event]" has a null value in JSON.');
      return true;
    }());

    return CreateEventRequest(
      accountId: mapValueOfType<String>(json, r'account_id')!,
      calendarId: mapValueOfType<String>(json, r'calendar_id'),
      event: SpatioEvent.fromJson(json[r'event'])!,
      sendUpdates: CreateEventRequestSendUpdatesEnum.fromJson(json[r'send_updates']),
      conferenceType: mapValueOfType<String>(json, r'conference_type'),
    );
  }
  return null;
}