autofocusNode property
Returns the focusNode that should be autofocused based on the current form state. It's generally the first required form field that doesn't have a value
Implementation
@override
FocusNode? get autofocusNode {
final myAutofocusNode = _focusNodes.entries
.where((entry) {
final currentValue = get<Object>(entry.key);
return currentValue.isNullOrBlank;
})
.firstOrNull
?.value;
if (myAutofocusNode != null) return myAutofocusNode;
for (final subform in _subforms) {
final subformFocus = subform!.autofocusNode;
if (subformFocus != null) return subformFocus;
}
return null;
}