fromJson static method
Returns a new UpdateQuestionConfigBody instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static UpdateQuestionConfigBody? 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 UpdateQuestionConfigBody(
name: mapValueOfType<String>(json, r'name'),
question: mapValueOfType<String>(json, r'question'),
helpText: mapValueOfType<String>(json, r'helpText'),
type: mapValueOfType<String>(json, r'type'),
numStars: mapValueOfType<double>(json, r'numStars'),
min: mapValueOfType<double>(json, r'min'),
max: mapValueOfType<double>(json, r'max'),
defaultValue: mapValueOfType<double>(json, r'defaultValue'),
labelNegative: mapValueOfType<String>(json, r'labelNegative'),
labelPositive: mapValueOfType<String>(json, r'labelPositive'),
customOptions: QuestionConfigCustomOptionsInner.listFromJson(json[r'customOptions']),
subQuestionIds: json[r'subQuestionIds'] is Iterable
? (json[r'subQuestionIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
alwaysShowSubQuestions: mapValueOfType<bool>(json, r'alwaysShowSubQuestions'),
reportingOrder: mapValueOfType<double>(json, r'reportingOrder'),
);
}
return null;
}