saveAndValidate method
Save form values and validate all fields of form
Focus to first invalid field when has field invalid, if focusOnInvalid
is true
.
By default true
Auto scroll to first invalid field focused if autoScrollWhenFocusOnInvalid
is true
.
By default false
.
Note: If a invalid field is from type TextField and will focused,
the form will auto scroll to show this invalid field.
In this case, the automatic scroll happens because is a behavior inside the framework,
not because autoScrollWhenFocusOnInvalid
is true
.
Implementation
bool saveAndValidate({
bool focusOnInvalid = true,
bool autoScrollWhenFocusOnInvalid = false,
}) {
save();
return validate(
focusOnInvalid: focusOnInvalid,
autoScrollWhenFocusOnInvalid: autoScrollWhenFocusOnInvalid,
);
}