popToFirst method

void popToFirst()

Pops to root/first value of stack. All next values are removed from stack.

Implementation

void popToFirst() {
  if (!canPop) {
    return;
  }

  final item = _stack[0];

  _stack.clear();
  _stack.add(item);

  _notifyParent();
}