selection property

SelectionModel<T> get selection
inherited

The selection model this container represents.

Implementation

SelectionModel<T> selection = SelectionModel.empty();
  1. @override
set selection (SelectionModel<T> newSelection)
override

The selection model this container represents.

Implementation

@override
set selection(SelectionModel<T> newSelection) {
  _changeDetector.markForCheck();
  super.selection = newSelection;
  _setInitialActiveItem();

  _selectionListener?.cancel();
  _selectionListener = selection.selectionChanges.listen((changes) {
    _changeDetector.markForCheck();
    // Update active item if new items are selected.
    var added =
        changes.last.added.isNotEmpty ? changes.last.added.first : null;
    if (added != null && !activeModel.isActive(added)) {
      activeModel.activate(added);
    }
    emitSelectionChange();
  });
}