BlocBuilder handles building a widget in response to new states.
BlocBuilder is analogous to StreamBuilder but has simplified API to
reduce the amount of boilerplate code needed as well as bloc-specific
performance improvements.
Please refer to BlocListener if you want to "do" anything in response to
state changes such as navigation, showing a dialog, etc...
BlocConsumer exposes a builder and listener in order react to new
states.
BlocConsumer is analogous to a nested BlocListener
and BlocBuilder but reduces the amount of boilerplate needed.
BlocConsumer should only be used when it is necessary to both rebuild UI
and execute other reactions to state changes in the bloc.
Takes a BlocWidgetListener and an optional bloc and invokes
the listener in response to state changes in the bloc.
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...
The listener is guaranteed to only be called once for each state change
unlike the builder in BlocBuilder.
This class facilitates overriding BlocObserver and EventTransformer.
It should be extended by another class in client code with overrides
that construct a custom implementation. The implementation in this class
defaults to the base blocObserver and eventTransformer implementation.
For example:
Takes a Create function that is responsible for
creating the Bloc or Cubit and a child which will have access
to the instance via BlocProvider.of(context).
It is used as a dependency injection (DI) widget so that a single instance
of a Bloc or Cubit can be provided to multiple widgets within a subtree.
BlocSelector is analogous to BlocBuilder but allows developers to
filter updates by selecting a new value based on the bloc state.
Unnecessary builds are prevented if the selected value does not change.
You can cancel a request by using a cancel token.
One token can be shared with different requests.
when a token's cancel method invoked, all requests
with this token will be cancelled.
LogInterceptor is used to print logs during network requests.
It's better to add LogInterceptor to the tail of the interceptor queue,
otherwise the changes made in the interceptor behind A will not be printed out.
This is because the execution of interceptors is in the order of addition.
a scrollPhysics for config refresh scroll effect,enable viewport out of edge whatever physics it is
in ClampingScrollPhysics, it doesn't allow to flip out of edge,but in RefreshPhysics,it will allow to do that,
by parent physics passing,it also can attach the different of iOS and Android different scroll effect
it also handles interception scrolling when refreshed, or when the second floor is open and closed.
with SpringDescription passing,you can custom spring back animate,the more paramter can be setting in RefreshConfiguration
Takes a Create function that is responsible for creating the repository
and a child which will have access to the repository via
RepositoryProvider.of(context).
It is used as a dependency injection (DI) widget so that a single instance
of a repository can be provided to multiple widgets within a subtree.
This is the most important component that provides drop-down refresh and up loading.
RefreshController must not be null,Only one controller to one SmartRefresher
ListFormat specifies the array format
(a single parameter with multiple parameter or multiple parameters with the same name)
and the separator for array items.
Signature for the buildWhen function which takes the previous state and
the current state and is responsible for returning a bool which
determines whether to rebuild BlocBuilder with the current state.
Signature for the listenWhen function which takes the previous state
and the current state and is responsible for returning a bool which
determines whether or not to call BlocWidgetListener of BlocListener
with the current state.
Signature for the builder function which takes the BuildContext and
state and is responsible for returning a widget which is to be rendered.
This is analogous to the builder function in StreamBuilder.