vmEmptyView<T extends BaseViewModel<BaseModel, BaseEntity>> function
Widget
vmEmptyView<
T extends BaseViewModel<BaseModel, BaseEntity>>({ - required dynamic builder(
- T vm
),
- bool isEmpty(
- T vm
)?,
- Widget? nullChild,
})
Implementation
Widget vmEmptyView<T extends BaseViewModel>(
{required Function(T vm) builder,
bool Function(T vm)? isEmpty,
Widget? nullChild}) {
return Consumer<T>(
builder: (_, vm, __) {
// LogUtil.printLog(vm.empty);
bool isNull = isEmpty != null ? isEmpty(vm) : vm.empty;
return isNull
? nullChild ?? ViewStateEmptyWidget(onTap: () => vm.viewRefresh())
: builder(vm);
},
);
}