appObjectX method
Implementation
Widget appObjectX(NotifierBuilder<T?> widget,
{Widget Function()? onError,
Widget Function()? onEmpty,
Widget Function()? onLoading,
Function? onRetry}) {
return SimpleBuilder(builder: (_) {
if (status.isLoading) {
return onLoading != null ? onLoading() : const Text('Loading');
} else if (status.isError) {
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);
});
}