submit method
SUBMIT/POST
Implementation
Future<bool> submit() async {
if (mounted) {
setState(() {
isLoading = true;
});
} else {
isLoading = true;
}
try {
if (!formKey.currentState!.validate()) {
LogbotLogger().warning("INVALID FORM", json.encode(formData));
return false;
}
formKey.currentState!.save();
LogbotLogger().debug("FORM DATA", formData.toString());
await submitApiCall(formData);
return true;
} catch (e, s) {
LogbotLogger().error("SUBMIT ERROR", e.toString(), s);
if (mounted) {
setState(() {
isLoading = false;
});
} else {
isLoading = false;
}
return false;
}
}