SelectFormField<T> constructor
SelectFormField<T> ({})
Creates a SelectFormField with the given options.
Implementation
SelectFormField({
required super.label,
super.description = '',
required this.options,
super.initialValue,
super.validator,
super.focused = false,
}) {
if (initialValue != null) {
final idx = options.indexWhere((opt) => opt.value == initialValue);
if (idx != -1) {
_selectedIndex = idx;
value = options[idx].value;
}
} else if (options.isNotEmpty) {
value = options[0].value;
}
}