fromJson static method
Returns a new CommentLogData instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CommentLogData? 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 CommentLogData(
clearContent: mapValueOfType<bool>(json, r'clearContent'),
isDeletedUser: mapValueOfType<bool>(json, r'isDeletedUser'),
phrase: mapValueOfType<String>(json, r'phrase'),
badWord: mapValueOfType<String>(json, r'badWord'),
word: mapValueOfType<String>(json, r'word'),
locale: mapValueOfType<String>(json, r'locale'),
tenantBadgeId: mapValueOfType<String>(json, r'tenantBadgeId'),
badgeId: mapValueOfType<String>(json, r'badgeId'),
wasLoggedIn: mapValueOfType<bool>(json, r'wasLoggedIn'),
foundUser: mapValueOfType<bool>(json, r'foundUser'),
verified: mapValueOfType<bool>(json, r'verified'),
engine: mapValueOfType<String>(json, r'engine'),
engineResponse: mapValueOfType<String>(json, r'engineResponse'),
engineTokens: mapValueOfType<double>(json, r'engineTokens'),
trustFactor: mapValueOfType<double>(json, r'trustFactor'),
source_: mapValueOfType<String>(json, r'source'),
rule: SpamRule.fromJson(json[r'rule']),
userId: mapValueOfType<String>(json, r'userId'),
subscribers: mapValueOfType<double>(json, r'subscribers'),
notificationCount: mapValueOfType<double>(json, r'notificationCount'),
votesBefore: mapValueOfType<double>(json, r'votesBefore'),
votesUpBefore: mapValueOfType<double>(json, r'votesUpBefore'),
votesDownBefore: mapValueOfType<double>(json, r'votesDownBefore'),
votesAfter: mapValueOfType<double>(json, r'votesAfter'),
votesUpAfter: mapValueOfType<double>(json, r'votesUpAfter'),
votesDownAfter: mapValueOfType<double>(json, r'votesDownAfter'),
repeatAction: RepeatCommentHandlingAction.fromJson(json[r'repeatAction']),
reason: RepeatCommentCheckIgnoredReason.fromJson(json[r'reason']),
otherData: mapValueOfType<Object>(json, r'otherData'),
spamBefore: mapValueOfType<bool>(json, r'spamBefore'),
spamAfter: mapValueOfType<bool>(json, r'spamAfter'),
permanentFlag: CommentLogDataPermanentFlagEnum.fromJson(json[r'permanentFlag']),
approvedBefore: mapValueOfType<bool>(json, r'approvedBefore'),
approvedAfter: mapValueOfType<bool>(json, r'approvedAfter'),
reviewedBefore: mapValueOfType<bool>(json, r'reviewedBefore'),
reviewedAfter: mapValueOfType<bool>(json, r'reviewedAfter'),
textBefore: mapValueOfType<String>(json, r'textBefore'),
textAfter: mapValueOfType<String>(json, r'textAfter'),
expireBefore: mapDateTime(json, r'expireBefore', r''),
expireAfter: mapDateTime(json, r'expireAfter', r''),
flagCountBefore: mapValueOfType<double>(json, r'flagCountBefore'),
trustFactorBefore: mapValueOfType<double>(json, r'trustFactorBefore'),
trustFactorAfter: mapValueOfType<double>(json, r'trustFactorAfter'),
referencedCommentId: mapValueOfType<String>(json, r'referencedCommentId'),
invalidLocale: mapValueOfType<String>(json, r'invalidLocale'),
detectedLocale: mapValueOfType<String>(json, r'detectedLocale'),
detectedLanguage: mapValueOfType<String>(json, r'detectedLanguage'),
);
}
return null;
}