updateItem method
Returns a StoreList with updated by id
identificator value
object.
Implementation
StoreList<T> updateItem(Object? id, T? value) {
final self = this;
if (id == null || value == null) {
return self;
}
final updateIndex = items.indexWhere((e) => e.id == id);
if (updateIndex < 0) {
return self;
}
final updatedItems = items.rebuild((b) => b[updateIndex] = value);
return StoreList(updatedItems);
}