FLUTTER ECOSYSTEM

appsup-dart/sortedmap

キーと値の両方について並べ替えおよびフィルタリングが可能なオブジェクトのマップ

sortedmap のプロジェクト画像
Stars
7
Forks
4
最終プッシュ(UTC)
2026/05/30
プロジェクト状態
公開中
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.