focus method
Sets focus to a child control.
The argument name
is a dot-delimited string that define the path to the
control.
Example:
Focus a child control by name.
final array = fb.array(['john', 'susan']);
// UI text field get focus and the device keyboard pop up
array.focus('0');
Focus a nested child control by path.
final array = fb.array({
[fb.group({'name': ''})]
});
// UI text field get focus and the device keyboard pop up
array.focus('0.name');
Implementation
@override
void focus([String name = '']) {
if (name.isNotEmpty) {
final control =
findControlInCollection(name.split(_controlNameDelimiter));
if (control != null) {
control.focus();
}
} else if (_controls.isNotEmpty) {
_controls.first.focus();
}
}