SelectionModel<T> class
abstract
Provides pattern to manage a collection of selected values.
This is used in model-view architecture to notify interested parties of
changes
to selection.
- Implemented types
- Mixed-in types
-
- CastIterable<
T>
- CastIterable<
- Implementers
Constructors
- SelectionModel.empty()
-
Creates an immutable, constant model.
constfactory
-
SelectionModel.multi({List<
T> selectedValues, KeyProvider<T> ? keyProvider}) -
Creates a multi-selection model.
factory
- SelectionModel.radio(T selected)
-
Creates a single-selection model that always has a value selected.
factory
-
SelectionModel.single({T? selected, KeyProvider<
T> ? keyProvider}) -
Creates a single-selection model.
factory
Properties
-
changes
→ Stream<
List< ChangeRecord> > -
Emits a list of changes when the state of the object changes.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasObservers → bool
-
True if this object has any observers.
no setterinherited
- hasSelectionObservers → bool
-
Returns true if a subscriber is listening to selectionChanges.
no setterinherited
- isEmpty → bool
-
Returns true if selection is empty.
no setter
- isNotEmpty → bool
-
Returns true if selection is not empty.
no setter
- isSingleSelect → bool
-
Whether or not the selection model is single select.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selectedValues
→ Iterable<
T> -
Returns ordered list of selected values.
no setter
-
selectionChanges
→ Stream<
List< SelectionChangeRecord< >T> > -
A stream that returns changes to selected elements.
no setterinherited
Methods
-
castIterable(
Iterable values) → Iterable< T> -
Casts
values
into an Iterableoverride -
clear(
) → void - Clears selection.
-
deliverChanges(
) → bool -
If
hasObservers
, synchronously emitschanges
that have been queued.inherited -
deliverSelectionChanges(
) → bool -
Synchronously deliver all SelectionChangeRecords.
inherited
-
deselect(
T value) → bool - Removes a value from list of selected items.
-
isSelected(
T value) → bool - Returns whether an item is selected.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyChange(
[ChangeRecord? change]) → void -
Schedules
change
to be delivered.inherited -
notifyPropertyChange<
T> (Symbol field, T oldValue, T newValue) → T -
Notify that the
field
name of this object has been changed.inherited -
notifySelectionChange(
{Iterable< T> added, Iterable<T> removed}) → void -
Schedules a SelectionChangeRecord.
inherited
-
observed(
) → void -
May override to be notified when
changes
is first observed.inherited -
select(
T value) → bool -
Adds
value
to list of selected items. -
toString(
) → String -
A string representation of this object.
inherited
-
unobserved(
) → void -
May override to be notified when
changes
is no longer observed.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited