flutter_bloc_basic library Null safety

Classes

AnsiColor
This class handles colorizing of terminal output.
AppRoute
A route that is added to the router tree.
AppRouteMatch
A matched AppRoute
AutoSize
AutoWidgetsFlutterBinding
BaseApp
BaseDio
BaseOptions
The common config for the Dio instance. dio.options is a instance of BaseOptions
BaseRepository
BaseRepositoryState<W extends StatefulWidget, E, S, R extends BaseRepository, RB extends RepositoryBloc<E, S, R>>
需要注入数据仓库的state W => StatefulWidget E => Bloc.Event Bloc事件 S => Bloc.State Bloc状态 R => Repository 数据仓库 RB => RepositoryBloc 含有数据仓库的Bloc
BaseResponse<T>
BaseResponseConverter<T>
BaseState<W extends StatefulWidget, E, S, B extends Bloc<E, S>>
不需要数据仓库注入的state W => StatefulWidget E => Bloc.Event Bloc事件 S => Bloc.State Bloc状态 B => Bloc
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 BlocBase<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 BlocBase<S>, S>
Base class for widgets that build themselves based on interaction with a specified bloc.
BlocConsumer<B extends BlocBase<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.
BlocListener<B extends BlocBase<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 BlocBase<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.
BlocProvider<T extends BlocBase<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 BlocBase<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.
CancelToken
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.
Change<State>
A Change represents the change from one State to another. A Change consists of the currentState and nextState.
ConsoleOutput
Default implementation of LogOutput.
Cubit<State>
A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
DefaultTransformer
DevelopmentFilter
Prints all logs with level >= Logger.level while in development mode (eg when asserts are evaluated, Flutter calls this debug mode).
Dio
A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, File downloading etc. and Dio is very easy to use.
DioMixin
Emitter<State>
An Emitter is a class which is capable of emitting new states.
Error
ErrorInterceptorHandler
Handler for error interceptor.
EventResetTheme
FluroRouter
Attach FluroRouter to MaterialApp by connnecting FluroRouter.generator to MaterialApp.onGenerateRoute.
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
Global
Handler
The handler to register with FluroRouter.define
Headers
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
HybridPrinter
A decorator for a LogPrinter that allows for the composition of different printers to handle different log messages. Provide it's constructor with a base printer, but include named parameters for any levels that have a different printer:
Interceptor
Dio instance may have interceptor(s) by which you can intercept requests/responses/errors before they are handled by then or catchError. See also:
Interceptors
Interceptors are a queue, and you can add any number of interceptors, All interceptors will be executed in first in first out order.
InterceptorsWrapper
InterceptorsWrapper is a helper class, which is used to conveniently create interceptor(s). See also:
ListParam<T>
LocalStorageUtil
本地Key:Value存储工具类
Lock
Add lock/unlock API for interceptors.
LogEvent
LogFilter
An abstract filter of log messages.
LogfmtPrinter
Outputs a logfmt message:
Logger
Use instances of logger to send log messages to the LogPrinter.
LogInterceptor
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.
LogOutput
Log output receives a OutputEvent from LogPrinter and sends it to the desired destination.
LogPrinter
An abstract handler of log events.
MemoryOutput
Buffers OutputEvents.
MultiBlocListener
Merges multiple BlocListener widgets into one widget tree.
MultiBlocProvider
Merges multiple BlocProvider widgets into one widget tree.
MultiOutput
Logs simultaneously to multiple LogOutput outputs.
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.
路由导航工具类
Options
Every request can pass an Options object which will be merged with Dio.options
OutputEvent
PrefixPrinter
A decorator for a LogPrinter that allows for the prepending of every line in the log output with a string for the level of that log. For example:
PrettyPrinter
Default implementation of LogPrinter.
ProductionFilter
Prints all logs with level >= Logger.level even in production.
QueuedInterceptor
Serialize the request/response/error before they enter the interceptor.
QueuedInterceptorsWrapper
QueuedInterceptorsWrapper is a helper class, which is used to conveniently create QueuedInterceptor(s). See also:
RedirectRecord
RepositoryBloc<E, S, R extends BaseRepository>
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
Handler for request interceptor.
RequestOptions
Response<T>
Response describes the http Response info.
ResponseBody
ResponseInterceptorHandler
Handler for response interceptor.
Result
RouteMatch
The route that was matched.
RouterProvider
配置定义路由抽象类
RouteTree
A RouteTree
RouteTreeNode
A node on RouteTree
RouteTreeNodeMatch
A matched RouteTreeNode
SimplePrinter
Outputs simple log messages:
StreamOutput
Success<T>
ThemeBloc
ThemeEvent
ThemeState
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.

Mixins

OptionsMixin

Extensions

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

Functions

LogD(String msg) → dynamic
LogE(String msg) → dynamic
LogI(String msg) → dynamic
LogV(String msg) → dynamic
LogW(String msg) → dynamic
LogWTF(String msg) → dynamic
runAutoApp(Widget app) → void

Enums

DioErrorType
HandlerType
The type of the handler, whether it's a buildable route or a function that is called when routed.
Level
Levels to control logging output. Logging can be enabled to include all levels above certain Level.
ListFormat
ListFormat specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name) and the separator for array items.
Method
ResponseType
ResponseType indicates which transformation should be automatically applied to the response data by Dio.
RouteMatchType
The match type of the route.
RouteTreeNodeType
A RouteTreeNote type
TransitionType
The type of transition to use when pushing/popping a route.

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.
CreateGlobalBlocProviders = List<BlocProvider<BlocBase<Object?>>> Function()
CreateRepositoryProviders = List<RepositoryProvider> Function()
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.
HandlerFunc = Widget? Function(BuildContext? context, Map<String, List<String>> parameters)
Builds out a screen based on string path parameters and context.
HeaderForEachCallback = void Function(String name, List<String> values)
InterceptorErrorCallback = void Function(DioError e, ErrorInterceptorHandler handler)
InterceptorSendCallback = void Function(RequestOptions options, RequestInterceptorHandler handler)
InterceptorSuccessCallback = void Function(Response e, ResponseInterceptorHandler handler)
JsonDecodeCallback = dynamic Function(String)
The default Transformer for Dio. If you want to custom the transformation of request/response data, you can provide a Transformer by your self, and replace the DefaultTransformer by setting the dio.Transformer.
LogCallback = void Function(LogEvent event)
OutputCallback = void Function(OutputEvent event)
ProgressCallback = void Function(int count, int total)
Callback to listen the progress for sending/receiving data.
RequestEncoder = List<int> Function(String request, RequestOptions options)
ResponseDecoder = String Function(List<int> responseBytes, RequestOptions options, ResponseBody responseBody)
RouteCreator<T> = Route<T> Function(RouteSettings route, Map<String, List<String>> parameters)
A function that creates new routes.
TransitionFunction<Event, State> = Stream<Transition<Event, State>> Function(Event)
@Deprecated - Use on<Event> with an EventTransformer instead. Will be removed in v8.0.0
ValidateStatus = bool Function(int? status)

Exceptions / Errors

BaseException
自定义异常
BlocUnhandledErrorException
Exception thrown when an unhandled error occurs within a bloc.
BusinessException
业务异常
DioError
DioError describes the error info when request failed.
OtherException
其他异常 如Json解析错误等
ProviderNotFoundException
The error that will be thrown if Provider.of fails to find a Provider as an ancestor of the BuildContext used.
RouteNotFoundException
When the route is not found.
ServerException
服务器异常
TcpException
连接异常