fromJson static method
Returns a new GetCommentsResponsePublicComment instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static GetCommentsResponsePublicComment? 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'status'), 'Required key "GetCommentsResponsePublicComment[status]" is missing from JSON.');
assert(json[r'status'] != null, 'Required key "GetCommentsResponsePublicComment[status]" has a null value in JSON.');
assert(json.containsKey(r'comments'), 'Required key "GetCommentsResponsePublicComment[comments]" is missing from JSON.');
assert(json[r'comments'] != null, 'Required key "GetCommentsResponsePublicComment[comments]" has a null value in JSON.');
assert(json.containsKey(r'user'), 'Required key "GetCommentsResponsePublicComment[user]" is missing from JSON.');
assert(json.containsKey(r'pageNumber'), 'Required key "GetCommentsResponsePublicComment[pageNumber]" is missing from JSON.');
assert(json[r'pageNumber'] != null, 'Required key "GetCommentsResponsePublicComment[pageNumber]" has a null value in JSON.');
return true;
}());
return GetCommentsResponsePublicComment(
statusCode: mapValueOfType<int>(json, r'statusCode'),
status: mapValueOfType<String>(json, r'status')!,
code: mapValueOfType<String>(json, r'code'),
reason: mapValueOfType<String>(json, r'reason'),
translatedWarning: mapValueOfType<String>(json, r'translatedWarning'),
comments: PublicComment.listFromJson(json[r'comments']),
user: UserSessionInfo.fromJson(json[r'user']),
urlIdClean: mapValueOfType<String>(json, r'urlIdClean'),
lastGenDate: mapValueOfType<int>(json, r'lastGenDate'),
includesPastPages: mapValueOfType<bool>(json, r'includesPastPages'),
isDemo: mapValueOfType<bool>(json, r'isDemo'),
commentCount: mapValueOfType<int>(json, r'commentCount'),
isSiteAdmin: mapValueOfType<bool>(json, r'isSiteAdmin'),
hasBillingIssue: mapValueOfType<bool>(json, r'hasBillingIssue'),
moduleData: mapCastOfType<String, Object>(json, r'moduleData') ?? const {},
pageNumber: mapValueOfType<int>(json, r'pageNumber')!,
isWhiteLabeled: mapValueOfType<bool>(json, r'isWhiteLabeled'),
isProd: mapValueOfType<bool>(json, r'isProd'),
isCrawler: mapValueOfType<bool>(json, r'isCrawler'),
notificationCount: mapValueOfType<int>(json, r'notificationCount'),
hasMore: mapValueOfType<bool>(json, r'hasMore'),
isClosed: mapValueOfType<bool>(json, r'isClosed'),
presencePollState: mapValueOfType<int>(json, r'presencePollState'),
customConfig: CustomConfigParameters.fromJson(json[r'customConfig']),
);
}
return null;
}