constructSubJson method
inherited
Implementation
Map<String, dynamic> constructSubJson(Type? parentParameterObjectType,
{Client? client}) {
// Collect all properties for this class
var propertiesAndMirror = _allPropertiesAndMirror(this);
var properties = propertiesAndMirror.item1;
var mirror = propertiesAndMirror.item2;
_parameterMap = {};
// Iterate over all properties
for (var property in properties) {
var parameterAttribute = SubJsonParameter.getSubJsonParameter(
parentParameterObjectType, property);
if (parameterAttribute == null) {
// Ignore any properties that are not annotated with a JsonParameter attribute
continue;
}
// get the value of the property
try {
var value = mirror.invokeGetter(property.simpleName);
if (value == null &&
parameterAttribute.necessity == Necessity.optional) {
// Ignore any optional parameters that are null
continue;
}
add(parameterAttribute, value);
} catch (e) {
// If the property is not set, ignore it
continue;
}
}
return _parameterMap;
}