Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

generic class in dart

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.");  
 
PREVIOUS NEXT
Tagged: #generic #class #dart
ADD COMMENT
Topic
Name
6+8 =