fromJson static method
Returns a new APITicketDetail instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static APITicketDetail? 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'_id'), 'Required key "APITicketDetail[_id]" is missing from JSON.');
assert(json[r'_id'] != null, 'Required key "APITicketDetail[_id]" has a null value in JSON.');
assert(json.containsKey(r'urlId'), 'Required key "APITicketDetail[urlId]" is missing from JSON.');
assert(json[r'urlId'] != null, 'Required key "APITicketDetail[urlId]" has a null value in JSON.');
assert(json.containsKey(r'userId'), 'Required key "APITicketDetail[userId]" is missing from JSON.');
assert(json[r'userId'] != null, 'Required key "APITicketDetail[userId]" has a null value in JSON.');
assert(json.containsKey(r'managedByTenantId'), 'Required key "APITicketDetail[managedByTenantId]" is missing from JSON.');
assert(json[r'managedByTenantId'] != null, 'Required key "APITicketDetail[managedByTenantId]" has a null value in JSON.');
assert(json.containsKey(r'assignedUserIds'), 'Required key "APITicketDetail[assignedUserIds]" is missing from JSON.');
assert(json[r'assignedUserIds'] != null, 'Required key "APITicketDetail[assignedUserIds]" has a null value in JSON.');
assert(json.containsKey(r'subject'), 'Required key "APITicketDetail[subject]" is missing from JSON.');
assert(json[r'subject'] != null, 'Required key "APITicketDetail[subject]" has a null value in JSON.');
assert(json.containsKey(r'createdAt'), 'Required key "APITicketDetail[createdAt]" is missing from JSON.');
assert(json[r'createdAt'] != null, 'Required key "APITicketDetail[createdAt]" has a null value in JSON.');
assert(json.containsKey(r'state'), 'Required key "APITicketDetail[state]" is missing from JSON.');
assert(json[r'state'] != null, 'Required key "APITicketDetail[state]" has a null value in JSON.');
assert(json.containsKey(r'fileCount'), 'Required key "APITicketDetail[fileCount]" is missing from JSON.');
assert(json[r'fileCount'] != null, 'Required key "APITicketDetail[fileCount]" has a null value in JSON.');
assert(json.containsKey(r'files'), 'Required key "APITicketDetail[files]" is missing from JSON.');
assert(json[r'files'] != null, 'Required key "APITicketDetail[files]" has a null value in JSON.');
return true;
}());
return APITicketDetail(
id: mapValueOfType<String>(json, r'_id')!,
urlId: mapValueOfType<String>(json, r'urlId')!,
userId: mapValueOfType<String>(json, r'userId')!,
managedByTenantId: mapValueOfType<String>(json, r'managedByTenantId')!,
assignedUserIds: json[r'assignedUserIds'] is Iterable
? (json[r'assignedUserIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
subject: mapValueOfType<String>(json, r'subject')!,
createdAt: mapValueOfType<String>(json, r'createdAt')!,
state: mapValueOfType<int>(json, r'state')!,
fileCount: mapValueOfType<int>(json, r'fileCount')!,
files: APITicketFile.listFromJson(json[r'files']),
reopenedAt: mapValueOfType<String>(json, r'reopenedAt'),
resolvedAt: mapValueOfType<String>(json, r'resolvedAt'),
ackAt: mapValueOfType<String>(json, r'ackAt'),
);
}
return null;
}