RxList<T> class

A reactive list that extends RxState and provides fine-grained reactivity on both list-level and index-level access.

This class allows tracking:

  • Whole list changes (add/remove/replace)
  • Individual index access tracking

It is typically used in reactive UI systems where rebuilds should be minimized and only triggered for specific dependencies.

Inheritance
Available extensions

Constructors

RxList(List<T> initial)
Creates a reactive list with an initial value.

Properties

hashCode int
The hash code for this object.
no setterinherited
id → dynamic
唯一标识符,用于调试或在 listenWithId 中识别来源。
finalinherited
isEmpty bool

Available on RxState<List<T>>, provided by the RxListToState extension

判断是否为空
no setter
isNotEmpty bool

Available on RxState<List<T>>, provided by the RxListToState extension

判断是否不为空
no setter
length int
Returns the length of the list.
no setter
length int

Available on RxState<List<T>>, provided by the RxListToState extension

获取列表长度
no setter
list List<T>
Returns the underlying raw list.
no setter
name String?
友好的名称,主要用于日志打印。
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value List<T>
获取当前值,并自动触发 RxStack 的依赖收集。
getter/setter pairinherited

Methods

add(T item) → void
Adds an item to the end of the list.
add(T element) → void

Available on RxState<List<T>>, provided by the RxListToState extension

向列表添加元素,并刷新 UI
addFieldListener(dynamic field, void listener(dynamic)) → void
inherited
addInternalListener(void listener(dynamic)) → void
inherited
addListener(void listener(dynamic)) → void
inherited
addListenerWithId(void listener(dynamic)) → void
inherited
bind(void onUpdate(List<T> value)) → void Function()
绑定一个监听器。
inherited
contains(T element) bool

Available on RxState<List<T>>, provided by the RxListToState extension

判断是否包含元素
deepEquals(dynamic a, dynamic b) bool
inherited
dispose() → void
销毁状态,清空所有监听器。
inherited
getItem(dynamic field) → dynamic
获取集合中的特定字段或索引。
inherited
internalUpdate(List<T> newValue) → void
inherited
listen(void onData(List<T> value)) → void Function()
监听值变化,并立即执行一次 onData
inherited
listenByKey(dynamic key, void onData(dynamic value)) → void Function()
监听特定字段的变化。
inherited
listenWhere(bool test(dynamic item), void onData(dynamic item)) → void Function()
inherited
listenWithId(void onData(List<T> value, dynamic id)) → void Function()
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyFieldListeners(dynamic field, bool notifyGlobal) → void
inherited
refresh() → void
手动触发通知。
inherited
remove(T element) → void

Available on RxState<List<T>>, provided by the RxListToState extension

从列表移除元素,并刷新 UI
removeAt(int index) → void
Removes the element at index.
removeFieldListener(dynamic field, void listener(dynamic)) → void
inherited
removeListener(void listener(dynamic)) → void
inherited
toString() String
A string representation of this object.
inherited
trackFieldAccess(dynamic field) → void
inherited
update(dynamic newValue) → void
更新整个状态或尝试类型转换更新。
inherited
updateAt(int index, T newValue, {bool notifyGlobal = false}) → void
Updates the value at a specific index.
updateField<K extends Object>(K field, Object? newValue, {bool notifyGlobal = false}) → void
更新 Map 的特定 Key 或 List 的特定 Index。
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) → T
Gets the element at index.
operator []=(int index, T newValue) → void
Updates the element at index with newValue.