Skip to content
pubscout

sorted

2.1.0, released 4 years ago by wolszon.me

Extension method to sort lists and iterables with custom rules.

WASM-ready
$ flutter pub add sorted
Source repository

What it does

Provides a `sorted` extension that orders collections using configurable rules such as ordered enums, comparable fields, or custom comparators. Supports stable merge sort and works on any `Iterable`.

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

Use it when

  • You need multi‑criteria or custom ordering for in‑memory collections.
  • You want a stable sort without mutating the original list.

Skip it when

  • You require reactive or stream‑based sorting.
  • You need sorting of massive data sets on a background isolate.

Strengths

  • Simple, chainable API via extension methods.
  • Supports stable merge sort and custom strategies.
  • Works on both List and Iterable without mutating the source.

Weaknesses

  • Only handles sorting; no other collection utilities.
  • No built‑in async or parallel sorting support.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
final sortedAuctions = auctions.sorted([
  SortedOrdered<Auction, AuctionStatus>((a) => a.buyerContext.status,
      [AuctionStatus.live, AuctionStatus.won, AuctionStatus.lost]),
  SortedComparable<Auction, DateTime>((a) => a.endedAt),
  SortedComparable<Auction, DateTime>((a) => a.endedAt, invert: true),
]);

Alternatives

Packages that do the same job and could replace sorted.