fromJson static method
Returns a new UpdatableCommentParams instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static UpdatableCommentParams? 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(() {
return true;
}());
return UpdatableCommentParams(
urlId: mapValueOfType<String>(json, r'urlId'),
urlIdRaw: mapValueOfType<String>(json, r'urlIdRaw'),
url: mapValueOfType<String>(json, r'url'),
pageTitle: mapValueOfType<String>(json, r'pageTitle'),
userId: mapValueOfType<String>(json, r'userId'),
commenterEmail: mapValueOfType<String>(json, r'commenterEmail'),
commenterName: mapValueOfType<String>(json, r'commenterName'),
commenterLink: mapValueOfType<String>(json, r'commenterLink'),
comment: mapValueOfType<String>(json, r'comment'),
commentHTML: mapValueOfType<String>(json, r'commentHTML'),
parentId: mapValueOfType<String>(json, r'parentId'),
date: mapValueOfType<double>(json, r'date'),
localDateString: mapValueOfType<String>(json, r'localDateString'),
localDateHours: mapValueOfType<int>(json, r'localDateHours'),
votes: mapValueOfType<int>(json, r'votes'),
votesUp: mapValueOfType<int>(json, r'votesUp'),
votesDown: mapValueOfType<int>(json, r'votesDown'),
expireAt: mapDateTime(json, r'expireAt', r''),
verified: mapValueOfType<bool>(json, r'verified'),
verifiedDate: mapDateTime(json, r'verifiedDate', r''),
notificationSentForParent: mapValueOfType<bool>(json, r'notificationSentForParent'),
notificationSentForParentTenant: mapValueOfType<bool>(json, r'notificationSentForParentTenant'),
reviewed: mapValueOfType<bool>(json, r'reviewed'),
externalId: mapValueOfType<String>(json, r'externalId'),
externalParentId: mapValueOfType<String>(json, r'externalParentId'),
avatarSrc: mapValueOfType<String>(json, r'avatarSrc'),
isSpam: mapValueOfType<bool>(json, r'isSpam'),
approved: mapValueOfType<bool>(json, r'approved'),
isDeleted: mapValueOfType<bool>(json, r'isDeleted'),
isDeletedUser: mapValueOfType<bool>(json, r'isDeletedUser'),
isByAdmin: mapValueOfType<bool>(json, r'isByAdmin'),
isByModerator: mapValueOfType<bool>(json, r'isByModerator'),
isPinned: mapValueOfType<bool>(json, r'isPinned'),
isLocked: mapValueOfType<bool>(json, r'isLocked'),
flagCount: mapValueOfType<int>(json, r'flagCount'),
displayLabel: mapValueOfType<String>(json, r'displayLabel'),
meta: APICommentBaseMeta.fromJson(json[r'meta']),
moderationGroupIds: json[r'moderationGroupIds'] is Iterable
? (json[r'moderationGroupIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
feedbackIds: json[r'feedbackIds'] is Iterable
? (json[r'feedbackIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
);
}
return null;
}