push method

E push(
  1. E element
)

Pushes an element onto the top of the stack.

Returns the element that was pushed.

Example:

final stack = Stack<int>();
final pushed = stack.push(42);
print(pushed); // 42

Implementation

E push(E element) {
  _elements.add(element);
  return element;
}