Skip to content
pubscout

sortedmap

0.5.5+1, released 9 days ago by appsup.be

A map of objects which can be sorted and filtered on both their key and value.

WASM-ready
$ flutter pub add sortedmap
Source repository

What it does

Provides SortedMap and FilteredMap classes that hold a map of objects ordered relative to each other. Unlike SplayTreeMap, objects can be ordered on both key and value, and filtered using validation functions and limits.

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

Use it when

  • You need maps sorted by combinations of keys and values rather than keys alone
  • You need to filter and limit entries within a map automatically

Skip it when

  • Standard Dart maps or SplayTreeMap are sufficient for your sorting needs

Strengths

  • Sorts on both keys and values
  • Supports filtering and size limits via FilteredMap
  • No external dependencies

Weaknesses

  • Limited documentation outside of basic examples

Setup

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

main() {
  var map = new SortedMap(Ordering.byValue());
  map.addAll({"a": 3, "b": 2, "c": 4, "d": 1});
  print(map.lastKeyBefore("c"));
  print(map.firstKeyAfter("d"));
}

Alternatives

Packages that do the same job and could replace sortedmap.

Works with

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