validateForm function
Implementation
Future<bool> validateForm({
LoadingButtonController? btnController,
required GlobalKey<FormState> formKey,
}) async {
if (!formKey.currentState!.validate()) {
showErrorNotice("Form not valid", "Please fill all *fields");
btnController?.error();
Future.delayed(const Duration(seconds: 5), () {
btnController?.reset();
});
return false;
}
formKey.currentState!.save();
return true;
}