sorted
2.1.0, released 4 years ago by wolszon.me
Extension method to sort lists and iterables with custom rules.
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.
- fast_immutable_collections
Fast immutable lists, sets, maps, and multimaps for Dart
91Compare - awesome_extensions
A comprehensive collection of Dart and Flutter extensions to reduce boilerplate code.
82Compare - dart_helper_utils
Dart extensions and helpers for maps, strings, collections, dates, async, and intl formatting.
80Compare - isolated_object
Wraps an object in a dedicated isolate and forwards method calls to it
79Compare