didUpdateWidget method
Called whenever the widget configuration changes.
Implementation
@override
void didUpdateWidget(covariant FormField<T> oldWidget) {
super.didUpdateWidget(oldWidget);
if (!identical(oldWidget, widget) && oldWidget._state == this) {
oldWidget._state = null;
}
widget._state = this;
if (widget.focusNode != oldWidget.focusNode) {
if (oldWidget.focusNode == null) {
_focusNode.dispose();
}
_focusNode =
widget.focusNode ?? FocusNode(id: 'form_field_${widget.hashCode}');
}
if (!identical(oldWidget, widget)) {
widget.value = oldWidget.value;
widget.errorText = oldWidget.errorText;
widget.touched = oldWidget.touched;
widget._focused = oldWidget._focused;
}
}