搜尋套件、儲存庫與 APP 分類

套件詳情v0.5.5

sortedmap

一個物件地圖,可根據其鍵和值進行排序和過濾

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3.9萬
喜歡數
43
Pub 分數
160

安裝套件

flutter pub add sortedmap

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

SortedMap 是一個 Dart 套件,透過根據鍵和值進行排序與過濾來擴展標準映射的功能。它提供了一種動態且類型安全的方式來管理鍵值對,同時根據使用者定義的標準維持順序。非常適合需要有序資料檢索的應用程式,例如即時儀表板或資料分析工具,支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。該套件可透過 pub.dev 與 Flutter 專案無縫整合,並提供直覺的 API,用於常見的操作,如過濾、映射和迭代已排序的項目。

適用情境

  • 即時資料儀表板
  • 有序資料儲存
  • 動態過濾鍵值對
  • 資料分析應用
  • 使用者介面狀態管理
  • 高效排序大型數據集

主要特色

  • 依鍵或值排序
  • 動態過濾項目
  • 支援所有 Flutter 平台
  • 類型安全的作業
  • 擴展 Map 接口
  • 高效迭代與查找

適合對象

  • 需要有序映射的開發者
  • 具備即時資料更新的應用程式
  • 資料密集型應用
  • 尋求增強地圖功能的 Flutter 開發人員
  • 需要靈活排序與篩選的專案

使用建議

  • 需要理解 Dart 泛型
  • 在非常大的資料集上可能會影響效能
  • 僅限記憶體儲存
  • 不適合用於持久化儲存需求
  • 依賴外部套件的維護

原始 README

以下為關聯原始碼儲存庫的 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.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。

所在榜單