Flutter 3.41 is live! Check out theFlutter 3.41 blog post!
The new Form, FormField auto-validation API
Gives more control in how to auto validate a Form and a FormField.
These breaking change docs are accurate, as of the release under which they are published. Over time, the workarounds described here might become inaccurate. We don't, in general, keep these breaking change docs up to date as of each release.
Thebreaking change index file lists the docs created for each release.
Summary
# The previous auto validation API for theForm andFormField widgets didn't control when auto validation should occur. So the auto validation for these widgets always happened on first build when the widget was first visible to the user, and you weren't able to control when the auto validation should happen.
Context
# Due to the original API not allowing developers to change the auto validation behavior for validating only when the user interacts with the form field, we added new API that allows developers to configure how they want auto validation to behave for theForm andFormField widgets.
Description of change
#The following changes were made:
- The
autovalidateparameter is deprecated. - A new parameter called
autovalidateMode, an Enum that accepts values from theAutovalidateModeEnum class, is added.
Migration guide
# To migrate to the new auto validation API you need to replace the usage of the deprecatedautovalidate parameter to the newautovalidateMode parameter. If you want the same behavior as before you can use:autovalidateMode = AutovalidateMode.always. This makes yourForm andFormField widgets auto validate on first build and every time it changes.
Code before migration:
classMyWidgetextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnFormField(autovalidate:true,builder:(FormFieldStatestate){returnContainer();},);}}Code after migration:
classMyWidgetextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnFormField(autovalidateMode:AutovalidateMode.always,builder:(FormFieldStatestate){returnContainer();},);}}Timeline
# Landed in version: 1.21.0-5.0.pre
In stable release: 1.22
References
#API documentation:
Relevant issues:
Relevant PRs:
Unless stated otherwise, the documentation on this site reflects Flutter 3.38.6. Page last updated on 2025-10-28.View source orreport an issue.