InputField<T> class

This base class must be extended by all input widgets.

This widget maintains the current state of the field, so that user input and validation failures are visually reflected in the UI.

Use a GlobalKey with InputField if you want to retrieve its current state, for example if you want one field to depend on another. ö An InputForm ancestor is not required. It simply makes it easier to enable, save, reset, or validate all input widgets at once.

See also:

  • InputForm - the widget that aggregates the fields.
  • InputText - a commonly used field for entering text.


InputField({Key key, bool autosave, bool autovalidate, InputDecoration decoration, bool enabled, T initialValue, Map<String, dynamic> map, ValueSetter<T> onChanged, ValueSetter<T> onSaved, String path, List<InputValidator> validators, bool wantKeepAlive = false})
Creates a single form field. [...]


autosave bool
Automatically saves a changed value. If autovalidate is true then a changed value will only be saved if there is no validation failure. Also invokes method onSaved. Default is true.
autovalidate bool
Automatically validates any change and updates error text accordingly. Default is false.
decoration InputDecoration
Decoration for the input field supplying frame, label, error text, ...
enabled bool
Whether the field accepts user input. Default is true.
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
initialValue → T
The fields value will initially be set to this initialValue.
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
map Map<String, dynamic>
map is used together with path to provide the initial value from and to save changes to the map. This parameter supersedes parameter map given to an InputForm ancestor.
onChanged ValueSetter<T>
An optional method to call on every change of the fields value.
onSaved ValueSetter<T>
An optional method to call with the final value when the form is saved through
path String
The path to the fields value in map. If the form is nested then path elements must be dot separated.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
validators List<InputValidator>
Methods that validate an input. The first failed validation will return an error string and no more validations will happen. [...]
wantKeepAlive bool
true will keep the state of all input fields within the same Slider even when the widget is scrolled out of view.


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() InputFieldState<T>
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel =}) String
A string representation of this object. [...]
toStringDeep({String prefixLineOne = '', String prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited