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

outdated

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
  while (stack.isNotEmpty) {
    stack.pop();
  }
  print(stack.isEmpty); // prints true
}
37
likes
0
pub points
91%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on stack