abstract_bloc library

Classes

AbstractConfiguration
AbstractFormBaseState
AbstractFormBasicState<TModel>
AbstractFormBloc<S extends AbstractFormBaseState>
AbstractFormBuilder<B extends StateStreamableSource<S>, S extends AbstractFormBaseState>
AbstractFormCubit<S extends AbstractFormBaseState>
AbstractFormErrorContainer
AbstractFormEvent
AbstractFormInitEvent
AbstractFormNoDataContainer
AbstractFormState<TModel, TModelValidator extends ModelValidator>
AbstractFormSubmitEvent<TModel>
AbstractFormUpdateEvent<TModel>
AbstractItemBloc<S extends AbstractItemState>
AbstractItemBuilder<B extends StateStreamableSource<S>, S extends AbstractItemState>
AbstractItemCubit<S extends AbstractItemState>
AbstractItemErrorContainer
AbstractItemEvent
AbstractItemFilterableState<TSearchModel, TItem>
AbstractItemLoadEvent<TSearchModel>
AbstractItemNoDataContainer
AbstractItemState<TItem>
AbstractLisErrorContainer
AbstractListBloc<S extends AbstractListState>
AbstractListBuilder<B extends StateStreamableSource<S>, S extends AbstractListState>
AbstractListCubit<S extends AbstractListState>
AbstractListEvent
AbstractListFilterablePaginatedState<TSearchModel extends Pagination, TListItem>
AbstractListFilterableState<TSearchModel, TListItem>
AbstractListLoadEvent<TSearchModel>
AbstractListLoadMoreEvent
AbstractListNoDataContainer
AbstractListRefreshEvent
AbstractListState<TListItem>
AbstractTranslations
AuthHandler
AuthOptions
BackgroundTransformer
The default Transformer for Dio.
BaseOptions
A set of base settings for each Dio(). BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
BezierCircleHeader
bezier + circle indicator,you can use this directly
BezierHeader
bezier container,if you need to implements indicator with bezier ,you can use consider about use this this will add the bezier container effect
Bloc<Event, State>
Takes a Stream of Events as input and transforms them into a Stream of States as output.
BlocBase<State>
An interface for the core functionality implemented by both Bloc and Cubit.
BlocBuilder<B extends StateStreamable<S>, S>
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...
BlocBuilderBase<B extends StateStreamable<S>, S>
Base class for widgets that build themselves based on interaction with a specified bloc.
BlocConsumer<B extends StateStreamable<S>, S>
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.
BlocEventSink<Event extends Object?>
An ErrorSink that supports adding events.
BlocListener<B extends StateStreamable<S>, S>
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.
BlocListenerBase<B extends StateStreamable<S>, S>
Base class for widgets that listen to state changes in a specified bloc.
BlocObserver
An interface for observing the behavior of Bloc instances.
BlocOverrides
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:
BlocProvider<T extends StateStreamableSource<Object?>>
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<B extends StateStreamable<S>, S, T>
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.
CacheHandler
CacheModel
CacheOptions
CacheResult<T>
CancelToken
Controls cancellation of Dio's requests.
Change<State>
A Change represents the change from one State to another. A Change consists of the currentState and nextState.
ClassicFooter
the most common indicator,combine with a text and a icon
ClassicHeader
the most common indicator,combine with a text and a icon
Closable
An object that must be closed when no longer in use.
CopyWith
Cubit<State>
A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
CustomFooter
a custom Indicator for footer,the usage I have put in CustomHeader,same with that See also
CustomHeader
a custom Indicator for header
Dio
Dio enables you to make HTTP requests easily.
DioMixin
Emittable<State extends Object?>
An object that can emit new states.
Emitter<State>
An Emitter is a class which is capable of emitting new states.
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
ErrorResult<T>
ErrorSink
A generic destination for errors.
ExceptionHandler
ExceptionOptions
This class is part of exception handling mechanism implemented in RestApiClient
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
FusedTransformer
A Transformer that has a fast path for decoding UTF8-encoded JSON. If the response is utf8-encoded JSON and no custom decoder is specified in the RequestOptions, this transformer is significantly faster than the default SyncTransformer and the BackgroundTransformer. This improvement is achieved by using a fused Utf8Decoder and JsonDecoder to decode the response, which is faster than decoding the utf8-encoded JSON in two separate steps, since Dart uses a special fast decoder for this case. See https://github.com/dart-lang/sdk/blob/5b2ea0c7a227d91c691d2ff8cbbeb5f7f86afdb9/sdk/lib/_internal/vm/lib/convert_patch.dart#L40
GridResult<TListItem>
GridResultJsonConfiguration
Headers
The headers class for requests and responses.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
InfoDialog
Interceptor
Interceptor helps to deal with RequestOptions, Response, and DioException during the lifecycle of a request before it reaches users.
Interceptors
A Queue-Model list for Interceptors.
InterceptorsWrapper
A helper class to create interceptors in ease.
LinkFooter
enable footer link other footer place outside the viewport
LinkHeader
enable header link other header place outside the viewport
ListParam<T>
Indicates a param being used as queries or form data, and how does it gets formatted.
LocalErrorResult<T>
LocalSuccessResult<T>
LoggingOptions
Options to customize logging of http requests/responses
LogInterceptor
LogInterceptor is used to print logs during network requests. It should be the last interceptor added, otherwise modifications by following interceptors will not be logged. This is because the execution of interceptors is in the order of addition.
MaterialClassicHeader
mostly use flutter inner's RefreshIndicator
ModelValidator
MultiBlocListener
Merges multiple BlocListener widgets into one widget tree.
MultiBlocProvider
Merges multiple BlocProvider widgets into one widget tree.
MultipartFile
A file to be uploaded as part of a MultipartRequest. This doesn't need to correspond to a physical file.
MultiRepositoryProvider
Merges multiple RepositoryProvider widgets into one widget tree.
NetworkResult<T>
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
Pagination
PaginationConfiguration
PropertyValidator<T>
QueuedInterceptor
Interceptor in queue.
QueuedInterceptorsWrapper
A helper class to create queued-interceptors in ease.
RedirectRecord
A record that records the redirection happens during requests, including status code, request method, and the location.
RefreshConfiguration
Controls how SmartRefresher widgets behave in a subtree.the usage just like ScrollConfiguration
RefreshController
A controller controll header and footer state, it can trigger driving request Refresh ,set the initalRefresh,status if needed
RefreshNotifier<T>
RefreshTokenInterceptor
RepositoryProvider<T>
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.
RequestInterceptorHandler
The handler for interceptors to handle before the request has been sent.
RequestOptions
The internal request option class that is the eventual result after BaseOptions and Options are composed.
Response<T>
The Response class contains the payload (could be transformed) that respond from the request, and other information of the response.
ResponseBody
The response wrapper class for adapters.
ResponseInterceptorHandler
The handler for interceptors to handle after respond.
RestApiClient
RestApiClientHeaders
RestApiClientImpl
RestApiClientKeys
Constant values used by RestApiClient
RestApiClientOptions
RestApiClientRequestOptions
Result<T>
SmartRefresher
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
SmartRefresherState
StateStreamable<State>
A Streamable that provides synchronous access to the current state.
StateStreamableSource<State>
A StateStreamable that must be closed when no longer in use.
Streamable<State extends Object?>
An object that provides access to a stream of states over time.
SuccessResult<T>
SyncTransformer
If you want to custom the transformation of request/response data, you can provide a Transformer by your self, and replace the transformer by setting the Dio.transformer.
Transformer
Transformer allows changes to the request/response data before it is sent/received to/from the server.
Transition<Event, State>
A Transition is the change from one state to another. Consists of the currentState, an event, and the nextState.
TwoLevelHeader
this header help you implements twoLevel function easyily, the behaviour just like TaoBao,XieCheng(携程) App TwoLevel
WaterDropHeader
QQ ios refresh header effect
WaterDropMaterialHeader
attach the waterdrop effect to MaterialClassicHeader

Enums

AbstractScrollBehaviour
BezierCircleType
BezierDismissType
DioExceptionType
The exception enumeration indicates what type of exception has happened during requests.
FormResultStatus
IconPosition
direction that icon should place to the text
ListFormat
Specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name). and the separator for array items.
LoadStatus
footer state
LoadStyle
footer indicator display style
RefreshStatus
header state
RefreshStyle
header indicator display style
ResponseType
Indicates which transformation should be applied to the response data.
ResultStatus
TwoLevelDisplayAlignment

Mixins

OptionsMixin
The mixin class for options that provides common attributes.

Extensions

ReadContext on BuildContext
Exposes the read method.
SelectContext on BuildContext
Adds a select method on BuildContext.
WatchContext on BuildContext
Exposes the watch method.

Functions

dateTimeFromJson(String? json) DateTime?

Typedefs

BlocBuilderCondition<S> = bool Function(S previous, S current)
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.
BlocListenerCondition<S> = bool Function(S previous, S current)
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.
BlocWidgetBuilder<S> = Widget Function(BuildContext context, S 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.
BlocWidgetListener<S> = void Function(BuildContext context, S state)
Signature for the listener function which takes the BuildContext along with the state and is responsible for executing in response to state changes.
BlocWidgetSelector<S, T> = T Function(S state)
Signature for the selector function which is responsible for returning a selected value, T, based on state.
DefaultTransformer = SyncTransformer
DioError = DioException
DioError describes the exception info when a request failed.
DioErrorType = DioExceptionType
Deprecated in favor of DioExceptionType and will be removed in future major versions.
DioMediaType = MediaType
The type (alias) for specifying the content-type of the MultipartFile.
EventHandler<Event, State> = FutureOr<void> Function(Event event, Emitter<State> emit)
An event handler is responsible for reacting to an incoming Event and can emit zero or more states via the Emitter.
EventMapper<Event> = Stream<Event> Function(Event event)
Signature for a function which converts an incoming event into an outbound stream of events. Used when defining custom EventTransformers.
EventTransformer<Event> = Stream<Event> Function(Stream<Event> events, EventMapper<Event> mapper)
Used to change how events are processed. By default events are processed concurrently.
FooterBuilder = Widget Function(BuildContext context, LoadStatus? mode)
custom footer builder,you can use second paramter to know what footerr state is
HeaderBuilder = Widget Function(BuildContext context, RefreshStatus? mode)
custom header builder,you can use second paramter to know what header state is
HeaderForEachCallback = void Function(String name, List<String> values)
The signature that iterates header fields.
IndicatorBuilder = Widget Function()
global default indicator builder
InterceptorErrorCallback = void Function(DioException error, ErrorInterceptorHandler handler)
The signature of Interceptor.onError.
InterceptorSendCallback = void Function(RequestOptions options, RequestInterceptorHandler handler)
The signature of Interceptor.onRequest.
InterceptorSuccessCallback = void Function(Response response, ResponseInterceptorHandler handler)
The signature of Interceptor.onResponse.
JsonDecodeCallback = FutureOr Function(String)
The callback definition for decoding a JSON string.
JsonEncodeCallback = FutureOr<String> Function(Object)
The callback definition for encoding a JSON object.
OnTwoLevel = void Function(bool isOpen)
when viewport not full one page, for different state,whether it should follow the content
OuterBuilder = Widget Function(Widget child)
wrap child in outside,mostly use in add background color and padding
ProgressCallback = void Function(int count, int total)
The type of a progress listening callback when sending or receiving data.
RefresherBuilder = Widget Function(BuildContext context, RefreshPhysics physics)
a builder for attaching refresh function with the physics
RequestEncoder = FutureOr<List<int>> Function(String request, RequestOptions options)
The type of a request encoding callback.
ResponseDecoder = FutureOr<String?> Function(List<int> responseBytes, RequestOptions options, ResponseBody responseBody)
The type of a response decoding callback.
ShouldFollowContent = bool Function(LoadStatus? status)
when viewport not full one page, for different state,whether it should follow the content
ValidateStatus = bool Function(int? status)
The type of a response status code validate callback.

Exceptions / Errors

BaseException
Base class for any RestApiClient exception that might happen during http requests/responses
DioException
DioException describes the exception info when a request failed.
ForbiddenException
Derived exception class that represents any server error
NetworkErrorException
Derived exception class that represents any network related error
NotNullableError<T>
A TypeError thrown by _checkNotNullable.
ProviderNotFoundException
The error that will be thrown if Provider.of fails to find a Provider as an ancestor of the BuildContext used.
ServerErrorException
Derived exception class that represents any server error
UnauthorizedException
Derived exception class that represents any server error
ValidationException
Derived exception class that represents any validation error