BaseListViewModel<M extends BaseModel, E extends BaseEntity, I> class abstract

基类 ListVM

Inheritance

Constructors

BaseListViewModel({dynamic params, dynamic refreshController})

Properties

busy bool
以下变量是为了代码书写方便,加入的变量.严格意义上讲,并不严谨
no setterinherited
checkEmpty bool
判断List 空的简便方法
getter/setter pairinherited
defaultOfParams ↔ dynamic
默认参数
getter/setter pairinherited
empty bool
no setterinherited
entity ↔ E?
entity 实体类 数据
getter/setter pairinherited
error bool
no setterinherited
errorMessage String?
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
idle bool
no setterinherited
list List<I>?
list 数据 ListOrGridEmpty 可以配置使用
no setter
model ↔ M
model API
getter/setter pairinherited
portMap Map<String, EventListen>
端口 key 跟 回调监听
no setterinherited
refreshController → dynamic
no setter
rootRefresh bool
根布局刷新
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unAuthorized bool
no setterinherited
viewState ViewModelState
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
eventButAdd(String key, EventListen listen) bool
端口添加 绑定端口跟回调
inherited
eventButDelete(String key) bool
端口删除
inherited
finishLoad(dynamic controller, {bool success = true, bool noMore = false}) → dynamic
完成上拉加载
finishRefresh(dynamic controller, {bool success = true, bool noMore = false}) → dynamic
完成下拉刷新
getModel() → M?
inherited
handleCatch(dynamic e, dynamic s, {bool hintError = true}) → void
Handle Error and Exception 统一处理子类的异常情况 e,有可能是Error,也有可能是Exception.所以需要判断处理 s 为堆栈信息
inherited
init() → void
inherited
initResultData() → void
请求数据后,子类初始数据
override
isHttp() bool
数据获取方式 是否是通过网络获取 可全局配置,子类覆写优先级最高
inherited
isSaveVM() bool
保存VM
inherited
item(int? index) → I
取出list中的item index 需正确
jointList(E newEntity) → void
拼接数据 当上拉加载后拼接新数据
judgeNull(DataResponse<E?>? data) bool
判断数据是否为空 可自行实现逻辑
loadMore({bool? globalRefresh}) Future<void>
上拉加载更多
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pageRefresh({bool busy = false, bool globalRefresh = true}) Future<void>
页面刷新 默认全局刷新,并不显示加载过程
inherited
pullRefresh({bool? globalRefresh}) Future<void>
下拉刷新
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
requestData(bool isLoad, int page, {dynamic params}) Future<DataResponse<E>?>
非http请求
inherited
requestHttp(bool isLoad, int page, {dynamic params}) Future<DataResponse<E>?>?
http请求
inherited
resetLoadState(dynamic controller) → dynamic
重置上拉加载状态
resetRefreshState(dynamic controller) → dynamic
重置下拉刷新状态
setBusy(bool value) → void
inherited
setEmpty() → void
inherited
setError(String message) → void
inherited
setUnAuthorized() → void
inherited
toString() String
A string representation of this object.
inherited
viewRefresh({dynamic params, bool notifier = true, bool busy = true, bool rootRefresh = false}) Future<void>
首次进入页面,主动调用页面刷新如果开启根布局不刷新设置ViewConfig.noRoot rootRefresh 需要根布局刷新 设置 true
inherited
waitDispose() List
存放需要dispose的对象
inherited

Operators

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

Static Properties

pageFirst int
分页第一页页码
getter/setter pair