KeyValueQuery class

键值型数据源(Hive / SharedPreferences 等)的公共工具 Shared helpers for key-value data sources (Hive / SharedPreferences / etc.)

Hive 与 SharedPreferences 两个 provider 的分页、排序、过滤逻辑此前几乎 逐行重复,且各自带着同样的排序崩溃缺陷,这里收敛为共享实现。 The Hive and SharedPreferences providers previously duplicated the paging, sorting and filtering logic almost line for line — and both carried the same sorting crash. The shared implementation lives here now.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

clampPaging(int limit, int offset) → ({int limit, int offset})
校验分页参数 / Validate paging parameters
sortKeys(List keys) → void
安全排序:Hive 的 key 是 dynamic,同时存在 int 与 String 时 List.sort() 会用 Comparable.compare 直接抛 TypeError。 这里同类型按自然序、不同类型按字符串序,永不抛异常。 Safe sort: Hive keys are dynamic, and mixing int and String makes List.sort() (which uses Comparable.compare) throw a TypeError. Same types compare naturally, mixed types fall back to string order — this never throws.

Constants

defaultLimit → const int
默认每页行数 / Default page size