fromJson static method
Returns a new CommentUserBadgeInfo instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CommentUserBadgeInfo? 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 "CommentUserBadgeInfo[id]" is missing from JSON.');
assert(json[r'id'] != null, 'Required key "CommentUserBadgeInfo[id]" has a null value in JSON.');
assert(json.containsKey(r'type'), 'Required key "CommentUserBadgeInfo[type]" is missing from JSON.');
assert(json[r'type'] != null, 'Required key "CommentUserBadgeInfo[type]" has a null value in JSON.');
assert(json.containsKey(r'description'), 'Required key "CommentUserBadgeInfo[description]" is missing from JSON.');
assert(json[r'description'] != null, 'Required key "CommentUserBadgeInfo[description]" has a null value in JSON.');
return true;
}());
return CommentUserBadgeInfo(
id: mapValueOfType<String>(json, r'id')!,
type: mapValueOfType<int>(json, r'type')!,
description: mapValueOfType<String>(json, r'description')!,
displayLabel: mapValueOfType<String>(json, r'displayLabel'),
displaySrc: mapValueOfType<String>(json, r'displaySrc'),
backgroundColor: mapValueOfType<String>(json, r'backgroundColor'),
borderColor: mapValueOfType<String>(json, r'borderColor'),
textColor: mapValueOfType<String>(json, r'textColor'),
cssClass: mapValueOfType<String>(json, r'cssClass'),
);
}
return null;
}