stack 0.2.2 copy "stack: ^0.2.2" to clipboard
stack: ^0.2.2 copied to clipboard

A package for stack data structure. have the push, pop, size, length, and top functionalities.

example/main.dart

import 'package:stack/stack.dart';

void main() {
  Stack<String> stack = Stack<String>();
  stack.push('abc');
  stack.push('edf');
  print(stack.pop()); // prints 'edf'
  print(stack.top()); // prints 'abc'
  print(stack.size()); // prints 1
  print(stack.length); // prints 1
  print(stack.contains('abc')); // prints true
  print(stack.contains('edf')); // prints false
  for (var i = 0; i < 10; i++) {
    stack.push(i.toString());
  }
  stack.print(); // prints the whole stack
  stack.clear();
  print(stack.isEmpty); // prints true
}
37
likes
150
points
9.88k
downloads

Publisher

unverified uploader

Weekly Downloads

A package for stack data structure. have the push, pop, size, length, and top functionalities.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on stack