fromJson static method
Returns a new CreateQuestionResultBody instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CreateQuestionResultBody? 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'urlId'), 'Required key "CreateQuestionResultBody[urlId]" is missing from JSON.');
assert(json[r'urlId'] != null, 'Required key "CreateQuestionResultBody[urlId]" has a null value in JSON.');
assert(json.containsKey(r'value'), 'Required key "CreateQuestionResultBody[value]" is missing from JSON.');
assert(json[r'value'] != null, 'Required key "CreateQuestionResultBody[value]" has a null value in JSON.');
assert(json.containsKey(r'questionId'), 'Required key "CreateQuestionResultBody[questionId]" is missing from JSON.');
assert(json[r'questionId'] != null, 'Required key "CreateQuestionResultBody[questionId]" has a null value in JSON.');
return true;
}());
return CreateQuestionResultBody(
urlId: mapValueOfType<String>(json, r'urlId')!,
value: mapValueOfType<double>(json, r'value')!,
questionId: mapValueOfType<String>(json, r'questionId')!,
anonUserId: mapValueOfType<String>(json, r'anonUserId'),
userId: mapValueOfType<String>(json, r'userId'),
commentId: mapValueOfType<String>(json, r'commentId'),
meta: MetaItem.listFromJson(json[r'meta']),
);
}
return null;
}