serializeObject method
- Object? object
inherited
Implementation
Object? serializeObject(Object? object) {
// if the value is an object type, we know by this point that it must inherit from Parameters
if (object is Model) {
// If the value is a Model, convert it to a map
return object.toJson();
} else if (object is Parameters) {
// If the value is a RequestParameters object, recursively add its parameters
return object.constructSubJson(runtimeType);
} else if (object is SerializableEnum) {
// If the value is a SerializableEnum, convert it to a string
return object.toString();
} else if (object is List<Object?>) {
// If the value is a list, recursively serialize each item in the list
List<Object?> valueList = [];
for (var item in object) {
valueList.add(serializeObject(item));
}
return valueList;
} else {
return object;
}
}