搜索插件、代码仓与 APP 分类

GitHub 代码仓appsup-dart/sortedmap

sortedmap

一个对象映射,可以根据其键和值进行排序和过滤

sortedmap 项目封面
星标
7
复刻
4
最近推送(UTC)
2026年5月30日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

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.

appsup-dart GitHub avatar
GitHub 作者

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

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗