本包是无代码生成反射的低级抽象,本质是自行注册字段元数据,而后获得类似反射的能力 Store是本基于本包的状态管理工具,使用更容易。 希望获得反射能力的类,需要按如下方法实现: base class X extends Store{ int i = Field(name:"",at:X,data:1).value; } print(X().fields) base Class modifiers 限定子类只能继承,不能implements ref: dart.cn/language/class-modifiers#base
- Inheritance
- Available extensions
Properties
-
fields
→ Map<
String, Signal> -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
typeArgs
→ List<
TypeHook> -
为了解决外部json程序无法获知Signal内部范型的问题,实验了一个类型钩子,
貌似可以解决此问题,目前还没想到其他更简单的方案。
json处理比较复杂,而且和Signal核心逻辑无关,还是把json、yaml等处理放在state.dart外部,
这样就需要一些机制可以拿到Map List的范型类型,比如:
Value
no setteroverride
Methods
-
field<
T> (String name, T value, {FromJson? fromJson}) → T -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
signal(
{String field = "", Type at = Null, String debugLabel = ""}) → T -
Available on T, provided by the StoreExtension extension
在自定义Store时需提供fieldat,会注册字段 -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited