SingleSelectionDropdownController<T> constructor

SingleSelectionDropdownController<T>({
  1. bool? unselectable,
  2. List<DropdownItem<T>>? items,
})

Implementation

SingleSelectionDropdownController({
  bool? unselectable,
  List<DropdownItem<T>>? items,
}) : super(unselectable ?? false) {
  if (items != null) {
    for (final item in items) {
      if (item.selected) {
        assert(_selectedItemValue == null,
            "Only one item can be selected at a time");
        _selectedItemValue = item.value;
      }
      _itemValues.add(item.value);
    }
  }
}