VmClass<T> class
运行时类型包装类
Constructors
-
VmClass({required String identifier, bool isExternal = true, List<
String> superclassNames = const [], Map<String, VmProxy< ? externalProxyMap, Map<T> >String, VmProxy< ? internalProxyMap, Map<T> >String, VmValue> ? internalStaticPropertyMap, List<Map< ? internalInstanceFieldTree, VmClass? internalSuperclass})VmKeys, dynamic> >
Properties
-
externalProxyMap
→ Map<
String, VmProxy< ?T> > -
外部导入类型的字段代理集合
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- identifier → String
-
对象的标识符
finalinherited
-
internalInstanceFieldTree
→ List<
Map< ?VmKeys, dynamic> > -
内部定义类型的实例字段的初始化树列表,初始化树采用列表可保证初始化顺序不变
final
-
internalProxyMap
→ Map<
String, VmProxy< ?T> > -
内部定义类型的字段代理集合
final
-
internalStaticPropertyMap
→ Map<
String, VmValue> ? -
内部定义类型的静态字段的已初始化集合,在相关调用时会将该集合放到作用域栈中
final
- isExternal → bool
-
是否为外部导入类型
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
superclassNames
→ List<
String> -
该包装类的深度递归的超类名
final
Methods
-
asThisType(
dynamic instance, bool question) → dynamic - 将实例转换为该包装类型的实例,实质上是做类型判断
-
getClass(
) → VmClass -
读取对象的对应包装类
override
-
getLogic(
) → dynamic -
读取对象的逻辑处理值
override
-
getProxy(
String propertyName, {required bool setter}) → VmProxy -
获取指定字段的代理,
setter
为true表示这是为设置属性而获取的代理,由于set函数在字段的末尾添加了等于符号,所以将优先查找'propertyName='这样的函数 -
getValue(
) → dynamic -
读取对象的原生数据值
override
-
hasProxy(
String propertyName, {required bool setter}) → bool - 检查指定字段的代理是否存在,逻辑与getProxy一样,只是用false代替异常的抛出,用于 xxx?.xxx 的调用
-
isThisType(
dynamic instance, bool question) → bool - 判断实例是否为该包装类型的实例
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setValue(
dynamic value) → dynamic -
设置对象的原生数据值 或 逻辑处理值
override
-
toJson(
) → Map< String, dynamic> -
转换为易读的JSON对象
override
-
toString(
) → String -
转换为易读的字符串描述
override
-
toTypeList(
List? source, {required bool canNull}) → List? - 内部定义的类型的T为VmVlue,如果使用T进行转换后,某些情况会报错 => type 'VmInstance' is not a subtype of type 'VmValue' of 'value' 如:
-
toTypeMap<
V> (Map? source, VmClass< V> vmclass, {required bool canNull1, required bool canNull2}) → Map? - 转换为精确的Mao<T, V>类型,目前Map的推导只有key才准确,实际返回的是Map<T, dynamic>类型
-
toTypeSet(
Set? source, {required bool canNull}) → Set? - 转换为精确的Set
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- baseClassDynamic → VmClass
-
非Object子类型dynamic
final
-
baseClassNull
→ VmClass<
Null> -
非Object子类型Null
final
-
baseClassVoid
→ VmClass<
void> -
非Object子类型void
final
-
libraryBaseList
→ List<
VmClass> -
非Object子类型列表
final
- quickTypeSpeculationMethod ↔ String? Function(dynamic instance)?
-
加速类型推测的函数
getter/setter pair
- slowTypeSpeculationReport ↔ void Function(dynamic instance, VmClass vmclass, int cycles, int total)?
-
很慢的类型推测报告
getter/setter pair
Static Methods
-
addClass(
VmClass vmclass) → VmClass -
添加包装类型
vmclass
到全局缓存,如果已存在则重新装载,不存在则添加带全局库中 -
registerInternalClassSearchRunner(
VmClass? searchRunner(String typeName)) → void - 注册当前运行器中搜索内部定义类型的回调函数
-
shutdownInternalClassSearchRunner(
) → void - 释放当前运行器中搜索内部定义类型的回调函数
-
sortClassDesc(
) → void - 按照继承数量逆序排列包装类型列表,这样能最大程度保证自动类型推测函数能返回继承链最长的包装类型
Constants
- functionTypeName → const String
- Function类型的名称
- newMethodName → const String
- new方法的名称
- objectTypeName → const String
- Object类型的名称
-
smartTypeNames
→ const List<
String> - 外部智能类型的名称列表