Skip to content
pubscout

collection

1.19.1, released 2 years ago by dart.dev

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

WASM-readyQuiet but busy
$ flutter pub add collection
Source repository

What it does

Provides additional utilities, wrappers, algorithms, equality comparers, and priority queues for working with collections in the style of dart:collection. It includes helpers for zipping iterables, sorting, binary search, and specialized collection types.

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

Use it when

  • You need advanced equality comparisons for maps, sets, and lists.
  • You want priority queues or space-efficient boolean lists.
  • You need convenient extension methods on iterables and lists like sorting, min, max, and slicing.

Skip it when

  • You only require standard Dart core collections and basic operations.
  • You need reactive state management collections that automatically trigger UI rebuilds.

Strengths

  • Comprehensive collection algorithms and equality utilities.
  • Extensive extension methods on standard iterables and lists.
  • Lightweight with no external dependencies.

Weaknesses

  • Does not provide reactive state management or automatic UI updates.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Simply add the package to your pubspec.yaml dependencies.

import 'package:collection/collection.dart';

void main() {
  final equality = const MapEquality(IdentityEquality(), ListEquality());
  print(equality.equals({'a': [1, 2]}, {'a': [1, 2]}));
}

Alternatives

Packages that do the same job and could replace collection.

  • weak_map

    A map whose keys are weakly held, and cache functions for memoization.

  • stream_transform

    Extension methods adding common stream transform operators

  • gtk

    GTK utilities for Flutter Linux applications, providing settings and application lifecycle helpers.

  • ordered_set

    Ordered Set that keeps elements sorted and allows duplicates by priority.

Works with

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