popToLast method

void popToLast()

Pops to last value of stack. All previous values are removed from stack.

Implementation

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

  final item = _last;

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

  _notifyParent();
}