mutate method

VoyagerStack mutate(
  1. void mutation(
    1. List<VoyagerStackItem> items
    )
)

creates a new copy of VoyagerStack with applied mutation

Implementation

VoyagerStack mutate(void Function(List<VoyagerStackItem> items) mutation) {
  final _newItems = List<VoyagerStackItem>.from(_items);
  mutation(_newItems);
  return VoyagerStack(_newItems, scope: _scope);
}