sortedmap 0.2.0

  • Installing
  • Versions
  • 51

Contains a SortedMap and FilteredMap class, which hold a map of objects that can be ordered relative to each other.

Unlike SplayTreeMap the objects can be ordered on both key and value or a combination of both.

The FilteredMap also allows to specify an isValid function on key/value pairs and limit the number of objects allowed in the map.


A simple usage example:

import 'package:sortedmap/sortedmap.dart';

main() {
  var map = new SortedMap((Pair a, Pair b)=>, b.value));
    "a": 3,
    "b": 2,
    "c": 4,
    "d": 1
  print(map.lastKeyBefore("c")); // a
  print(map.firstKeyAfter("d")); // b


A simple usage example:

import 'package:sortedmap/sortedmap.dart';

main() {
  var map = new FilteredMap(new Filter(
    compare: (Pair a, Pair b)=>, b.value),
    isValid: (Pair v) => v.key!="b",
    limit: 2));
    "a": 3,
    "b": 2,
    "c": 4,
    "d": 1
  print(map.keys); // (d, a)

Features and bugs

Please file feature requests and bugs at the issue tracker.



  • new FilteredMapView class
  • some api changes


  • keep elements after limit in FilteredMap


  • compare and isValid methods iso getters in Filter
  • strong mode fixes
  • linter


  • Initial version

1. Depend on it

Add this to your package's pubspec.yaml file:

  sortedmap: "^0.2.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:sortedmap/sortedmap.dart';
Version Uploaded Documentation Archive
0.2.0 Mar 7, 2017 Go to the documentation of sortedmap 0.2.0 Download sortedmap 0.2.0 archive
0.1.2 Feb 10, 2017 Go to the documentation of sortedmap 0.1.2 Download sortedmap 0.1.2 archive
0.1.1 Jun 17, 2016 Go to the documentation of sortedmap 0.1.1 Download sortedmap 0.1.1 archive
0.1.0 Jun 7, 2016 Go to the documentation of sortedmap 0.1.0 Download sortedmap 0.1.0 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


Describes how popular the package is relative to other packages. [more]
4 / 100
Code health derived from static analysis. [more]
95 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:sortedmap/sortedmap.dart.


  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use sortedmap.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
quiver >=0.22.0 <0.23.0 0.22.0 0.28.0
Transitive dependencies
matcher 0.12.1+4
path 1.5.1
stack_trace 1.9.1
Dev dependencies
test >=0.12.0 <0.13.0