FLUTTER ECOSYSTEM

appsup-dart/sortedmap

वस्तुओं का एक मानचित्र जिसे उनके कुंजी और मान पर दोनों क्रमबद्ध और फ़िल्टर किया जा सकता है

sortedmap प्रोजेक्ट कवर
Stars
7
Forks
4
अंतिम पुश (UTC)
30 मई 2026
प्रोजेक्ट स्थिति
सक्रिय
appsup-dart GitHub avatar
GITHUB Organization

appsup-dart ↗

भाषाएँDart

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 5 आइटम
  • testडेवलपमेंट^1.16.5
  • benchmark_testडेवलपमेंट^0.1.1+2
  • lintsडेवलपमेंट^6.0.0
  • quiverडेवलपमेंट^3.0.0
  • melosडेवलपमेंट^7.0.0

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

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.

SortedMap

A simple usage example:

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")); // a
  print(map.firstKeyAfter("d")); // b
  
}

FilteredMap

A simple usage example:

import 'package:sortedmap/sortedmap.dart';

main() {
  var map = new FilteredMap(new Filter(
    compare: (Pair a, Pair b)=>Comparable.compare(a.value, b.value),
    isValid: (Pair v) => v.key!="b",
    limit: 2));
  
  map.addAll({
    "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.