Implementation
// ignore: prefer_constructors_over_static_methods
static FComment? 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 "FComment[_id]" is missing from JSON.');
assert(json[r'_id'] != null, 'Required key "FComment[_id]" has a null value in JSON.');
assert(json.containsKey(r'tenantId'), 'Required key "FComment[tenantId]" is missing from JSON.');
assert(json[r'tenantId'] != null, 'Required key "FComment[tenantId]" has a null value in JSON.');
assert(json.containsKey(r'urlId'), 'Required key "FComment[urlId]" is missing from JSON.');
assert(json[r'urlId'] != null, 'Required key "FComment[urlId]" has a null value in JSON.');
assert(json.containsKey(r'url'), 'Required key "FComment[url]" is missing from JSON.');
assert(json[r'url'] != null, 'Required key "FComment[url]" has a null value in JSON.');
assert(json.containsKey(r'commenterName'), 'Required key "FComment[commenterName]" is missing from JSON.');
assert(json[r'commenterName'] != null, 'Required key "FComment[commenterName]" has a null value in JSON.');
assert(json.containsKey(r'comment'), 'Required key "FComment[comment]" is missing from JSON.');
assert(json[r'comment'] != null, 'Required key "FComment[comment]" has a null value in JSON.');
assert(json.containsKey(r'commentHTML'), 'Required key "FComment[commentHTML]" is missing from JSON.');
assert(json[r'commentHTML'] != null, 'Required key "FComment[commentHTML]" has a null value in JSON.');
assert(json.containsKey(r'date'), 'Required key "FComment[date]" is missing from JSON.');
assert(json.containsKey(r'verified'), 'Required key "FComment[verified]" is missing from JSON.');
assert(json[r'verified'] != null, 'Required key "FComment[verified]" has a null value in JSON.');
assert(json.containsKey(r'approved'), 'Required key "FComment[approved]" is missing from JSON.');
assert(json[r'approved'] != null, 'Required key "FComment[approved]" has a null value in JSON.');
assert(json.containsKey(r'locale'), 'Required key "FComment[locale]" is missing from JSON.');
return true;
}());
return FComment(
id: mapValueOfType<String>(json, r'_id')!,
tenantId: mapValueOfType<String>(json, r'tenantId')!,
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'),
anonUserId: mapValueOfType<String>(json, r'anonUserId'),
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: mapDateTime(json, r'date', r''),
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''),
verificationId: mapValueOfType<String>(json, r'verificationId'),
notificationSentForParent: mapValueOfType<bool>(json, r'notificationSentForParent'),
notificationSentForParentTenant: mapValueOfType<bool>(json, r'notificationSentForParentTenant'),
reviewed: mapValueOfType<bool>(json, r'reviewed'),
imported: mapValueOfType<bool>(json, r'imported'),
externalId: mapValueOfType<String>(json, r'externalId'),
externalParentId: mapValueOfType<String>(json, r'externalParentId'),
avatarSrc: mapValueOfType<String>(json, r'avatarSrc'),
isSpam: mapValueOfType<bool>(json, r'isSpam'),
permNotSpam: mapValueOfType<bool>(json, r'permNotSpam'),
aiDeterminedSpam: mapValueOfType<bool>(json, r'aiDeterminedSpam'),
hasImages: mapValueOfType<bool>(json, r'hasImages'),
pageNumber: mapValueOfType<int>(json, r'pageNumber'),
pageNumberOF: mapValueOfType<int>(json, r'pageNumberOF'),
pageNumberNF: mapValueOfType<int>(json, r'pageNumberNF'),
hasLinks: mapValueOfType<bool>(json, r'hasLinks'),
hasCode: mapValueOfType<bool>(json, r'hasCode'),
approved: mapValueOfType<bool>(json, r'approved')!,
locale: mapValueOfType<String>(json, r'locale'),
isDeleted: mapValueOfType<bool>(json, r'isDeleted'),
isDeletedUser: mapValueOfType<bool>(json, r'isDeletedUser'),
isBannedUser: mapValueOfType<bool>(json, r'isBannedUser'),
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'),
rating: mapValueOfType<double>(json, r'rating'),
displayLabel: mapValueOfType<String>(json, r'displayLabel'),
fromProductId: mapValueOfType<int>(json, r'fromProductId'),
meta: FCommentMeta.fromJson(json[r'meta']),
ipHash: mapValueOfType<String>(json, r'ipHash'),
mentions: CommentUserMentionInfo.listFromJson(json[r'mentions']),
hashTags: CommentUserHashTagInfo.listFromJson(json[r'hashTags']),
badges: CommentUserBadgeInfo.listFromJson(json[r'badges']),
domain: mapValueOfType<String>(json, r'domain'),
veteranBadgeProcessed: mapValueOfType<String>(json, r'veteranBadgeProcessed'),
moderationGroupIds: json[r'moderationGroupIds'] is Iterable
? (json[r'moderationGroupIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
didProcessBadges: mapValueOfType<bool>(json, r'didProcessBadges'),
fromOfflineRestore: mapValueOfType<bool>(json, r'fromOfflineRestore'),
autoplayJobId: mapValueOfType<String>(json, r'autoplayJobId'),
autoplayDelayMS: mapValueOfType<int>(json, r'autoplayDelayMS'),
feedbackIds: json[r'feedbackIds'] is Iterable
? (json[r'feedbackIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
logs: CommentLogEntry.listFromJson(json[r'logs']),
groupIds: json[r'groupIds'] is Iterable
? (json[r'groupIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
viewCount: mapValueOfType<int>(json, r'viewCount'),
requiresVerification: mapValueOfType<bool>(json, r'requiresVerification'),
editKey: mapValueOfType<String>(json, r'editKey'),
tosAcceptedAt: mapDateTime(json, r'tosAcceptedAt', r''),
botId: mapValueOfType<String>(json, r'botId'),
);
}
return null;
}