avoid-missing-controller
preset: recommended
Warns when a TextFormField
, TextField
or EditableText
does not have at least one way to get the updated value.
Not providing a controller or not getting an updated value in a callback leads to the widget state not being updated when the user updates the field.
Example
❌ Bad:
// LINT: Changes to this field's value are not saved to your widget's state. Try providing a controller or listening to the value change events.
TextFormField();
✅ Good:
TextFormField(controller: TextEditingController());
TextFormField(onChanged: (_) {});