submit method
dynamic
submit({})
Submit the form
If the form is valid, it will call the onSuccess
function
Implementation
submit(
{required Function(dynamic value) onSuccess,
Function(Exception exception)? onFailure,
bool showToastError = true}) {
Map<String, dynamic> rules = getValidate;
if (rules.isEmpty) {
onSuccess(data());
return;
}
/// Update the state with the rules and the onSuccess function
updateState(stateName, data: {
"onSuccess": onSuccess,
"onFailure": onFailure,
"showToastError": showToastError
});
}