ActiveItemModel<T> class

Manages a pointer to an item in a list.

The pointer may be moved sequentially or to an arbitrary item. When the item list is updated, the model keeps the previously active item as active if it is still in the list.

Implementers

Constructors

ActiveItemModel(IdGenerator? idGenerator, {bool loop = false, bool activateFirstItemByDefault = true, List<T> items = const []})
Creates an instance from the initial list of items. If idGenerator is null, a default instance (SequentialIdGenerator) is created.

Properties

activateFirstItemByDefault bool
Whether the first list item should activate whenever the changes.
getter/setter pair
activeId String
ID of currently active item.
no setter
activeItem → T?
Currently active item.
no setter
hashCode int
The hash code for this object.
no setterinherited
items List<T>
Sets the item list, activating the first item, if the previously active item is not in the new list of items.
no getter
modelChanged Stream
Stream of model change events
no setter
peekNext → T?
Returns the next possible active item as if activeNext was called.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

activate(T value) → void
Activates value. If value is not found, the active pointer is set to none.
activateFirst() → void
Activates first element in the list.
activateLast() → void
Activates last element in the list.
activateNext() → void
Activates next element in the list, if the active item is not already the last item.
activatePrevious() → void
Activates previous element in the list, if the active item is not already the first item.
id(T? item) String
Returns an unique id for item.
isActive(T item) bool
Determines whether item is active.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited