class Stack<T> { List<T> _stack = []; void push(T item) => _stack.add(item); T pop() => _stack.removeLast(); } // Example final stack = Stack<String>(); stack.push("A string.");