provide-input-field-label
Warns when TextField, TextFormField, or CupertinoTextField do not provide a decoration: InputDecoration(labelText: ...), a label widget, or have a Semantics wrapper with the label.
Text input fields in Flutter frequently use hintText or inline placeholder text without specifying a permanent labelText or wrapping in a Semantics(label: ...) widget.
When input fields lose focus or contain user-entered text, VoiceOver and TalkBack may read only the entered text without announcing the field's purpose.
Example
❌ Bad:
// LINT: Provide a label to input fields.
// Try passing 'labelText' or 'label' or wrapping this widget with 'Semantics'.
TextField();
// LINT: Provide a label to input fields.
// Try passing 'labelText' or 'label' or wrapping this widget with 'Semantics'.
TextField(decoration: InputDecoration());
// LINT: Provide a label to input fields.
// Try passing 'labelText' or 'label' or wrapping this widget with 'Semantics'.
TextFormField();
✅ Good:
TextField(decoration: InputDecoration(label: Text('some label')));
TextField(decoration: InputDecoration(labelText: 'some label'));
Semantics(label: 'some label', child: TextField());