Make input and additionalInput optional in StepRequestBody

Updated the StepRequestBody class to allow both 'input' and 'additionalInput' to be optional. Added logic in toJson() method to return an empty JSON object if both fields are null.
This commit is contained in:
hunteraraujo
2023-09-06 11:41:23 -07:00
parent ef2d64513b
commit a7c37da713

View File

@@ -1,10 +1,13 @@
class StepRequestBody {
final String input;
final String? input;
final Map<String, dynamic>? additionalInput;
StepRequestBody({required this.input, this.additionalInput});
Map<String, dynamic> toJson() {
if (input == null && additionalInput == null) {
return {};
}
return {'input': input, 'additional_input': additionalInput};
}
}