magic_mirror library

Classes

Boolean2String
默认的类型转换器 bool to String
ClassUriInfo
从uri中解析到的类信息
Double2Bool
默认的类型转换器 double to bool
Double2String
默认的类型转换器 double to String
GenUri
定义查找class的键的生成策略 返回结果必定为为uri
IMirrorRegister
类信息注册器
Initializer
魔镜初始化触发器 的父类
Int2Bool
默认的类型转换器 int to bool
Int2Double
默认的类型转换器 int to double
Int2String
默认的类型转换器 int to String
KeyGen
定义查找class的键的生成策略 返回结果必定为为uri 兼容包
LoadTypeAdapter
自动加载所有的转换器的初始化触发器
MagicMirror
所有的工具入口 利用预生成的策略生成可能用到的类的类似反射的使用模式
MAnnotation
基本注解需要的内容
MClass
定义Class的注解
MConstructor
指定Class的构造函数 当使用在默认构造函数上时(非命名构造函数) 会生成两种构造路径 "" 代表默认构造函数 就是非命名构造函数
MConstructorNot
构造函数必须时必须的map参数 且只有一个参数Map<String,dynamic>类型的参数 默认是uri的参数叠加传入的Map参数 若传入的arg非map则以null的key的值存在 禁止模式模式时有效 不扫描的构造函数
MField
指定Class的属性
MFieldNot
禁止模式时有效 不扫描的属性
MFunction
标注Class内的函数
MFunctionNot
禁止模式模式时有效 不扫描的方法
MImport
MirrorClass<T, A extends MReflectionEnable>
扫描到的类信息
MirrorConfig
MirrorConstructor<T, A extends MAnnotation>
扫描到的类的构造函数信息
MirrorField<T, A extends MAnnotation, V>
扫描到的属性信息
MirrorFunction<T, A extends MAnnotation, R>
扫描到的函数信息
MirrorParam<A extends MAnnotation, PT>
扫描到的参数信息
MMirrorConfig
定义Class生成器注解 dart特殊机制 自动化的入口 最好为lib/mirror_config.dart 内初始化速度最快
MParam
函数的参数 构造函数也是 可用来指定map中key 与实际不一致
MReflectionDisable
MReflectionEnable
定义需要扫描的类或者函数的 扫描配置的注解
OnInitializer
魔镜初始化触发器 的注解
Pair<K, V>
一个键值的容器
TypeAdapter
定义自定义的转换器
TypeConvert<From, To>
类型转换器 当调用属性 函数 时类型不匹配时来完成转换动作
TypeConvertAdapter<From, To>
类型转换器 当调用属性 函数 时类型不匹配时来完成转换动作 支持正向转换与反向转换
TypeToken<T>
用来获取具体类型
Void
标注函数的返回值为void

Extensions

ClassCompatible on MirrorClass<T, A>
类镜像的兼容包
Compatible on MagicMirror
提供之前版本的兼容包
ConstructorCompatible on MirrorConstructor<T, A>
构造函数的兼容包

Functions

cloneList<E>(List<E> source, E cloneFun(E e)) List<E>
深层copy list
findFistWhere<E>(List<E> list, bool test(E element), {E? orElse}) → E?
查找第一个符合条件的内容 可以返回null
genParams(dynamic param, Map<String, String> uriParams, String putKey) Map<String, dynamic>
将参数生成为可调用函数的map信息
removeDuplicate<E, P>(List<E> list, P getProperty(E element), {bool keepBehind = true}) List<E>
list中根据某条属性去重 keepBehind=true 从后往前去重 保留后边

Typedefs

MirrorConstructorInvoker<T> = T Function(Map<String, dynamic> params)
构造函数的代理执行器
MirrorFieldGetInvoker<T, V> = V? Function(T bean)
属性的get代理执行器
MirrorFieldSetInvoker<T, V> = void Function(T bean, V value)
属性的set代理执行器
MirrorFunctionInstance<T> = Function Function(T bean)
MirrorFunctionInvoker<T, R> = R? Function(T bean, Map<String, dynamic> params)
执行函数调用的代理执行器

Exceptions / Errors

ClassNotConfigException
类信息无法找到异常
ClassNotFoundException
类信息无法找到异常
IllegalArgumentException
参数类型异常
MagicMirrorException
当前库中所有异常的父类
NoSuchFieldException
属性未找到异常
NoSuchFunctionException
函数未找到异常