setSelectedOptions method

void setSelectedOptions(
  1. List<ValueItem<T>> options
)

select the options MultiSelectController is used to select the options.

Implementation

void setSelectedOptions(List<ValueItem<T>> options) {
  if (options.any((element) => value._disabledOptions.contains(element))) {
    throw Exception('Cannot select disabled options');
  }

  if (options.any((element) => !value._options.contains(element))) {
    throw Exception('Cannot select options that are not in the options list');
  }

  value._selectedOptions.clear();
  value._selectedOptions.addAll(options);
  notifyListeners();
}