Skip to content
pubscout

stack

0.2.2, released 3 years ago by an unverified publisher

A Dart package providing a stack data structure with push, pop, size, length, and top functionalities.

WASM-ready
$ flutter pub add stack
Source repository

What it does

It implements a stack data structure in Dart. It supports basic operations like push, pop, inspecting the top element, checking size and length, and checking if items are contained.

AI-written summary of version 0.2.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a standard LIFO (last-in, first-out) stack data structure in your Dart or Flutter application.
  • You want to manage operations such as push, pop, and top inspection without implementing them manually.

Skip it when

  • You require complex state management solutions or asynchronous stream handling.
  • You only need built-in collection types like List and do not require formal stack abstractions.

Strengths

  • Provides clear stack methods like push, pop, top, and size.
  • Supports null safety and works across multiple platforms including Android, iOS, web, and desktop.
  • Includes a Sized constructor to control stack size constraints.

Weaknesses

  • Limited in scope, handling only basic stack data structure features.
  • Throws an IllegalOperationException if top() or pop() is used on an empty stack.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:stack/stack.dart';

Stack<String> stack = Stack();
stack.push('abc');
stack.top();
stack.pop();

Alternatives

Packages that do the same job and could replace stack.

  • tuple

    Provides immutable tuple classes for grouping values.

  • collection

    Utility functions and classes that extend Dart's collection types and algorithms.

  • typed_data

    Utility functions and classes for easier work with dart:typed_data lists.

  • kdtree

    A fast Dart implementation of the k-dimensional (k-d) tree data structure.

Works with

Packages commonly used together with stack: ones it builds on, ones built on it, and its own family.