validate method
Validates the form by checking all input fields. Sets hasBeenSubmitted to true and returns true if the form is valid, otherwise false.
Implementation
bool validate() {
hasBeenSubmitted = true;
return formKey.currentState?.validate() ?? false;
}