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.
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.
- fast_immutable_collections
Fast immutable lists, sets, maps, and multimaps for Dart
91Compare - cv
Helpers to convert Dart objects to/from Map and JSON without code generation.
79Compare - weak_map
A map whose keys are weakly held, and cache functions for memoization.
80Compare - map_history
A Map implementation with history and rollback support for entries, keys and values.
63Compare
Works with
Packages commonly used together with sortedmap: ones it builds on, ones built on it, and its own family.