appListX method
Implementation
Widget appListX(NotifierBuilder<List<T>> widget,
{Widget Function()? onError,
Widget Function()? onEmpty,
Widget Function()? onLoading,
void Function()? onRetry}) {
return SimpleBuilder(builder: (_) {
if (status.isLoading) {
return onLoading != null ? onLoading() : Text('Loading');
} else if (status.isError) {
// if (status.errorType == ApiErrorType.forceNoResult) {
// return onForceEmpty != null
// ? onForceEmpty()
// : const Center(child: Text('No data found'));
// }
return onError != null ? onError() : const Center(child: Text('Error'));
} else if (status.isEmpty) {
return onEmpty != null
? onEmpty()
: const Center(child: Text('No data found'));
}
return widget(value);
});
}