BaseMultiVM class abstract

Inheritance
Implementers

Constructors

BaseMultiVM.new()

Properties

appbarController AppbarController
final
context BuildContext?
上下文
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
onDismissLoading OnDismissLoading?
getter/setter pairinherited
onShowLoading OnShowLoading?
getter/setter pairinherited
pageLifecycle PageLifecycle
页面生命周期
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateController ViewStateController
final
timers List<Timer>
finalinherited

Methods

cancelRequest(CancelToken cancelToken) → void
取消某个网络请求
inherited
checkHasPermissions(List<Permission> permissions) Future<bool>
检查是否有权限
inherited
createApi<API extends BaseApi>(API api) → API
创建api,这个方法主要是将api绑定到VM中,VM销毁时会去cancel其中的未完成请求
inherited
createLifecycleTimer(Duration duration, void callback()) Timer
创建具备ViewModel生周期自动销毁的Timer
inherited
dismissLoading() → void
隐藏loading弹框
inherited
download({required String urlPath, required dynamic filename, bool isNeedLoading = true, bool isLoadingCancelable = false, String? loadingTxt, Map<String, dynamic>? params, Map<String, dynamic>? body, Options? options, CancelToken? cancelToken, OnSuccess<File>? onSuccess, ProgressCallback? onProgress, OnFailed? onFailed}) → void
下载文件
inherited
getDelayCreateDuration() Duration
inherited
getString(MultiString multiString) String
根据MultiString获取字符串
inherited
hideKeyboard() → void
隐藏输入法
inherited
init(BuildContext context, PageLifecycle pageLifecycle) → void
inherited
isFinishing() bool
widget生命周期是否没开始或已经结束
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBackPressed() Future<bool>
返回按钮点击 注意,如果是带有BasePage嵌套BasePage的情况,子BasePage需要override并不执行pop操作 以上提到的BasePage是指BasePageBasePage的子类
inherited
onCreate() → void
onCreate生命周期
inherited
onDelayCreate() → void
inherited
onDestroy() → void
onDestroy生命周期
inherited
onPause() → void
onPause生命周期
inherited
onResume() → void
onResume生命周期
inherited
onRetry() → void
重试按钮被点击
pop<T extends Object?>({T? result, bool cantPopExit = true}) → void
页面退出,dialog的dismiss cantPopExit 如果不可pop的时候是否退出当前APP,默认是true
inherited
push<T>(Widget page, {bool finishCurr = false}) Future<T?>
跳转页面 page 需要跳转的页面 finishCurr 是否需要结束当前页面,注意确认当前页面是否可退出
inherited
request<T>({required Future<BaseResp<T>> future, bool isNeedLoading = true, bool isLoadingCancelable = false, String? loadingTxt, bool isShowErrorToast = false, bool isShowErrorDetailToast = false, OnSuccess<T>? onSuccess, OnFailed? onFailed}) → void
同步回调的网络请求
inherited
requestPermission(PermissionReq permissionReq) → void
请求权限
inherited
requestWithState<T>({required Future<BaseResp<T>> future, String? loadingTxt, bool isShowErrorDetail = false, String? retryTxt, OnSuccess<T>? onSuccess, OnFailed? onFailed}) → void
结合多状态UI的网络请求
showContentState() → void
展示内容状态的UI
showEmptyState({String? emptyTxt, String? retryTxt}) → void
展示空状态的UI
showErrorState({String? errorTxt, String? retryTxt}) → void
展示错误状态的UI
showKeyboard(FocusNode focusNode) → void
展示输入法
inherited
showLoading({String? loadingTxt, Color? barrierColor, bool barrierDismissible = false, bool cancelable = false}) → void
展示loading弹框 barrierColor 蒙层颜色 barrierDismissible 点击蒙层是否可以消失,默认不行 cancelable 返回按钮或者手势是否可以dismiss,默认不行
inherited
showLoadingState({String? loadingTxt}) → void
展示loading状态的UI
showToast(String? msg) → void
展示toast
inherited
toString() String
A string representation of this object.
inherited

Operators

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