view library

Classes

Empty
State indicating that data was loaded successfully, but was null or empty.
Failure
State indicating that loading or refreshing has failed. It contains an exact error that has occurred.
Initial
The initial view state.
Loading
State indicating that data is being loaded.
Refreshing<T>
State indicating that data is being refreshed. It can occur only after initial loading ends with Success or Empty result. It may contain the data that has already been loaded.
RefreshView
A widget that wraps a widget with a RefreshIndicator designed to be used with BLoC pattern. [...]
Success<T>
State indicating that data was loaded successfully and is not null nor empty. T - list element type.
ViewState
Base class for states.
ViewStateBuilder<T, C extends Cubit<ViewState>>
ViewStateBuilder is responsible for building the UI based on the ViewState. It's a wrapper over the BlocBuilder widget so it accepts a bloc object and a set of handy callbacks, which corresponds to each possible state: onReady builder for the the initial state, onLoading builder for the data loading state, onRefreshing builder for the data refreshing state, onSuccess builder for the data success state, onEmpty builder for for no result state, onError builder function for an error state. [...]
ViewStateListener<T, C extends Cubit<ViewState>>
ViewStateListener is responsible for performing an action based on the ViewState. It should be used for functionality that needs to occur only in response to a state change such as navigation, showing a SnackBar, showing a Dialog, etc. ViewStateListener is a wrapper over the BlocListener widget so it accepts a bloc object as well as a child widget and a set of handy callbacks corresponding to a given state: onLoading callback for the data loading state, onRefreshing callback for the data refreshing state, onSuccess callback for the data success state, onEmpty callback for for no result state, onError callback function for an error state. [...]

Typedefs

EmptyBuilder = Widget Function(BuildContext context)
Builder function for no result. The data was fetched successfully, but a null element was returned.
EmptyCallback = void Function(BuildContext context)
Callback function for no result. The data was fetched successfully, but a null element was returned.
ErrorBuilder = Widget Function(BuildContext context, dynamic error)
Builder function for an error. It contains an error that has caused which may allow a view to react differently on different errors.
ErrorCallback = void Function(BuildContext context, dynamic error)
Callback function for an error. It contains an error that has caused which may allow a view to react differently on different errors.
InitialBuilder = Widget Function(BuildContext context)
Builder function for the the initial state.
LoadingBuilder = Widget Function(BuildContext context)
Builder function for the data loading state.
LoadingCallback = void Function(BuildContext context)
Callback function for the data loading state.
RefreshingBuilder<T> = Widget Function(BuildContext context, T data)
Builder function for the data refreshing state. Can only occur after SuccessBuilder.
RefreshingCallback<T> = void Function(BuildContext context, T data)
Callback function for the data refreshing state
SuccessBuilder<T> = Widget Function(BuildContext context, T data)
Builder function for a success state. The data was fetched and nonnull element was returned.
SuccessCallback<T> = void Function(BuildContext context, T data)
Callback function for a success. The data was fetched and nonnull element was returned.
ViewStateBuilderCondition = bool Function(ViewState previous, ViewState current)
Signature for the buildWhen function which takes the previous ViewState and the current ViewState and returns a bool which determines whether to rebuild the view with the current state.
ViewStateListenerCondition = bool Function(ViewState previous, ViewState current)
Signature for the listenWhen function which takes the previous ViewState and the current ViewState and is responsible for returning a bool which determines whether or not to call the listener function.