validateForm function

Future<bool> validateForm({
  1. LoadingButtonController? btnController,
  2. required GlobalKey<FormState> formKey,
})

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;
}