fromJson static method
Returns a new TicketMobileDTOInternal instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static TicketMobileDTOInternal? 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(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "TicketMobileDTOInternal[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "TicketMobileDTOInternal[$key]" has a null value in JSON.');
});
return true;
}());
return TicketMobileDTOInternal(
id: mapValueOfType<int>(json, r'id'),
createdAt: mapDateTime(json, r'createdAt', r''),
modifiedAt: mapDateTime(json, r'modifiedAt', r''),
closedAt: mapDateTime(json, r'closedAt', r''),
subject: mapValueOfType<String>(json, r'subject'),
description: mapValueOfType<String>(json, r'description'),
ticketState: TicketMobileDTOInternalTicketStateEnum.fromJson(json[r'ticketState']),
possibleTicketStates: json[r'possibleTicketStates'] is Iterable
? (json[r'possibleTicketStates'] as Iterable).cast<String>().toList(growable: false)
: const [],
ticketPriority: TicketMobileDTOInternalTicketPriorityEnum.fromJson(json[r'ticketPriority']),
dueDate: mapDateTime(json, r'dueDate', r''),
ticketCategory: mapValueOfType<String>(json, r'ticketCategory'),
ticketArea: mapValueOfType<String>(json, r'ticketArea'),
projectName: mapValueOfType<String>(json, r'projectName'),
tags: json[r'tags'] is Iterable
? (json[r'tags'] as Iterable).cast<String>().toList(growable: false)
: const [],
ticketMembersContactInfo: TicketMemberContactDTOInternal.listFromJson(json[r'ticketMembersContactInfo']),
relations: TicketRelatedDTOInternal.listFromJson(json[r'relations']),
privateTicket: mapValueOfType<bool>(json, r'privateTicket'),
noComments: mapValueOfType<bool>(json, r'noComments'),
ticketMemberCount: mapValueOfType<int>(json, r'ticketMemberCount'),
pinned: mapValueOfType<bool>(json, r'pinned'),
relatedEntities: TicketRelatedDTOInternal.listFromJson(json[r'relatedEntities']),
actionTokens: json[r'actionTokens'] == null
? const {}
: ActionFeedbackDTOInternal.mapListFromJson(json[r'actionTokens']),
actions: ActionDTOInternal.listFromJson(json[r'actions']),
attachments: TicketAttachmentDTOInternal.listFromJson(json[r'attachments']),
ignoreMemberCountWarning: mapValueOfType<bool>(json, r'ignoreMemberCountWarning'),
checklist: ChecklistItemMobileDTOInternal.listFromJson(json[r'checklist']),
subtickets: TicketMobileBaseDTOInternal.listFromJson(json[r'subtickets']),
customReminderSchema: CustomReminderSchemaDTOInternal.fromJson(json[r'customReminderSchema']),
);
}
return null;
}