fromJson static method
Returns a new TicketMobileWithLastCommentDTO instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static TicketMobileWithLastCommentDTO? 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 "TicketMobileWithLastCommentDTO[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "TicketMobileWithLastCommentDTO[$key]" has a null value in JSON.');
});
return true;
}());
return TicketMobileWithLastCommentDTO(
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: TicketMobileWithLastCommentDTOTicketStateEnum.fromJson(json[r'ticketState']),
possibleTicketStates: json[r'possibleTicketStates'] is Iterable
? (json[r'possibleTicketStates'] as Iterable).cast<String>().toList(growable: false)
: const [],
ticketPriority: TicketMobileWithLastCommentDTOTicketPriorityEnum.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: TicketMemberContactDTO.listFromJson(json[r'ticketMembersContactInfo']),
relations: TicketRelatedDTO.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'),
lastCommentText: mapValueOfType<String>(json, r'lastCommentText'),
lastCommentAuthorSubjectId: mapValueOfType<int>(json, r'lastCommentAuthorSubjectId'),
lastCommentAuthor: mapValueOfType<String>(json, r'lastCommentAuthor'),
lastCommentCreatedAt: mapDateTime(json, r'lastCommentCreatedAt', r''),
allCommentAuthorSubjectIds: json[r'allCommentAuthorSubjectIds'] is Iterable
? (json[r'allCommentAuthorSubjectIds'] as Iterable).cast<int>().toList(growable: false)
: const [],
allCommentAuthorRelationshipIds: json[r'allCommentAuthorRelationshipIds'] is Iterable
? (json[r'allCommentAuthorRelationshipIds'] as Iterable).cast<int>().toList(growable: false)
: const [],
);
}
return null;
}