ListOperation<T> class sealed

Describes an operation on a cached list.

Provides built-in operations for common list mutations with type safety.

Example:

// Append an item
final op = ListOperation.append(newItem);

// Update items matching a condition
final op = ListOperation.updateWhere(
  (item) => item.id == targetId,
  (item) => item.copyWith(name: 'New Name'),
);

// Remove items matching a condition
final op = ListOperation.removeWhere((item) => item.id == targetId);
Implementers

Constructors

ListOperation.append(T item)
Append an item to the end of the list.
const
factory
ListOperation.insert(int index, T item)
Insert an item at a specific index.
const
factory
ListOperation.prepend(T item)
Prepend an item to the beginning of the list.
const
factory
ListOperation.removeWhere(bool predicate(T))
Remove items matching a predicate.
const
factory
ListOperation.updateWhere(bool predicate(T), T update(T))
Update items matching a predicate.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
item → T?
Get the item being added/modified by this operation, if any.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply(List<T> list) List<T>
Apply this operation to a list and return the result.
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