TreeSelectionOptions<T>.fromList constructor

TreeSelectionOptions<T>.fromList(
  1. List<TreeSelectionOptionData<T>> listOfOptions, {
  2. ItemRenderer<T>? itemRenderer,
  3. Comparator<T>? comparator,
})

Implementation

TreeSelectionOptions.fromList(List<TreeSelectionOptionData<T>> listOfOptions,
    {ItemRenderer<T>? itemRenderer, Comparator<T>? comparator})
    : _itemRenderer = itemRenderer ?? defaultItemRenderer,
      _itemsOptions = Map<T, TreeSelectionOptionData<T>>.fromIterable(
          listOfOptions,
          key: (item) => (item as TreeSelectionOptionData<T>).value),
      super(const []) {
  _comparator = comparator ?? _defaultComparator;
  _parentToChildrenMap = _generateParentToChildrenMap(listOfOptions)
      as Map<T, List<OptionGroup<T>>>;

  /// Sets the actual options to start from.
  optionGroups = _parentToChildrenMap.remove(null) ?? [OptionGroup<T>([])];
}