fromJson static method
Returns a new CalendarAccountError instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CalendarAccountError? 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 "CalendarAccountError[account_id]" is missing from JSON.');
assert(json[r'account_id'] != null, 'Required key "CalendarAccountError[account_id]" has a null value in JSON.');
assert(json.containsKey(r'account_name'), 'Required key "CalendarAccountError[account_name]" is missing from JSON.');
assert(json[r'account_name'] != null, 'Required key "CalendarAccountError[account_name]" has a null value in JSON.');
assert(json.containsKey(r'error_code'), 'Required key "CalendarAccountError[error_code]" is missing from JSON.');
assert(json[r'error_code'] != null, 'Required key "CalendarAccountError[error_code]" has a null value in JSON.');
assert(json.containsKey(r'error_message'), 'Required key "CalendarAccountError[error_message]" is missing from JSON.');
assert(json[r'error_message'] != null, 'Required key "CalendarAccountError[error_message]" has a null value in JSON.');
return true;
}());
return CalendarAccountError(
accountId: mapValueOfType<String>(json, r'account_id')!,
accountName: mapValueOfType<String>(json, r'account_name')!,
errorCode: mapValueOfType<String>(json, r'error_code')!,
errorMessage: mapValueOfType<String>(json, r'error_message')!,
);
}
return null;
}