TextFieldState class

Maintains a TextEditingController and a FocusNode for a State and its Widgets.

Just pass controller and/or focusNode to your TextField or TextFormField and be notified via the *Changed callbacks.

Call update() during State.didUpdateWidget() if your state's widget has a controller or focusNode. Also call it during State.initState() if the TextFieldState instance was constructed before initState().

Don't forget to call dispose() from State.dispose()!

Constructors

TextFieldState({_TextChanged? textChanged, _FocusChanged? focusChanged, _FocusChanged? primaryFocusChanged, String? text, TextEditingController? controller, FocusNode? focusNode})
controller, focusNode, and text are from the state's widget, if applicable. They are provided here for convenience instead of having to call update() after construction.

Properties

controller TextEditingController
no setter
focusChanged → _FocusChanged?
final
focusNode FocusNode
no setter
hashCode int
The hash code for this object.
no setterinherited
primaryFocusChanged → _FocusChanged?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String
no setter
textChanged → _TextChanged?
final

Methods

dispose() → void
Call this during State.dispose().
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
update({TextEditingController? controller, FocusNode? focusNode, String? text}) → void
Call this during State.didUpdateWidget() if your state's widget has a controller or focusNode.

Operators

operator ==(Object other) bool
The equality operator.
inherited