flutter_form_bloc
library
Classes
-
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.
-
BooleanFieldBloc<ExtraData>
-
A
FieldBloc
used for bool
type.
-
BooleanFieldBlocState<ExtraData>
-
-
CanShowFieldBlocBuilder
-
-
Change<State>
-
A Change represents the change from one
State
to another.
A Change consists of the currentState and nextState.
-
CheckboxFieldBlocBuilder
-
A material design checkbox.
-
CheckboxFieldTheme
-
The theme of CheckboxFieldBlocBuilder and CheckboxGroupFieldBlocBuilder
-
CheckboxGroupFieldBlocBuilder<Value>
-
A material design checkboxes.
-
ChipFieldItem
-
-
ChoiceChipFieldBlocBuilder<T>
-
FilterChip
-
ChoiceChipFieldTheme
-
The theme of ChoiceChipFieldBlocBuilder
-
ClearSuffixButton
-
-
ClearSuffixButtonTheme
-
The theme of ClearSuffixButton
-
Closable
-
An object that must be closed when no longer in use.
-
Cubit<State>
-
A Cubit is similar to Bloc but has no notion of events
and relies on methods to emit new states.
-
DateFormat
-
DateFormat is for formatting and parsing dates in a locale-sensitive
manner.
-
DateTimeFieldBlocBuilder
-
-
DateTimeFieldTheme
-
The theme of DateTimeFieldBlocBuilder
-
DropdownFieldBlocBuilder<Value>
-
A material design dropdown.
-
DropdownFieldTheme
-
The theme of DropdownFieldBlocBuilder
-
EditableText
-
A basic text input field.
-
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.
-
ErrorSink
-
A generic destination for errors.
-
FieldBlocBuilder
-
-
FieldBlocState<Value, Suggestion, ExtraData>
-
-
FieldBlocValidators
-
-
FieldBlocValidatorsErrors
-
-
FieldItem
-
Class that defines the properties of an item contained in a field
-
FilterChipFieldBlocBuilder<T>
-
FilterChip
-
FilterChipFieldTheme
-
The theme of FilterChipFieldBlocBuilder
-
FlexGroupStyle
-
Flex
-
FormBloc<SuccessResponse, FailureResponse>
-
The base class for all
FormBlocs
.
-
FormBlocDeleteFailed<SuccessResponse, FailureResponse>
-
It is the state when the form are deleting and fail.
The previous state must be FormBlocDeleting.
-
FormBlocDeleteSuccessful<SuccessResponse, FailureResponse>
-
It is the state when the form is deleted successfully.
The previous state must be FormBlocDeleting.
-
FormBlocDeleting<SuccessResponse, FailureResponse>
-
It is the state when FormBloc.delete is called.
-
FormBlocFailure<SuccessResponse, FailureResponse>
-
It is the state when the form are submitting and fail.
The previous state must be FormBlocSubmitting.
-
FormBlocListener<FormBloc extends FormBloc<SuccessResponse, ErrorResponse>, SuccessResponse, ErrorResponse>
-
BlocListener that reacts to the state changes of the FormBloc.
-
FormBlocLoaded<SuccessResponse, FailureResponse>
-
It is the state when you can
submit
the FormBloc.
-
FormBlocLoadFailed<SuccessResponse, FailureResponse>
-
It is the state when you failed to pre/fill the
fieldBlocs
. The previous state must be FormBlocLoading.
-
FormBlocLoading<SuccessResponse, FailureResponse>
-
It is the state when you need to pre/fill the
fieldBlocs
usually with asynchronous data.
The previous state must be FormBlocLoading.
-
FormBlocObserver
-
FormBlocObserver hide
events
and transitions
of any FieldBloc or FormBloc
from the child.
-
FormBlocState<SuccessResponse, FailureResponse>
-
The base class for all Form Bloc States:
-
FormBlocStep
-
A material step used in
Stepper
. The step can have a title and subtitle,
an icon within its circle, some content and a state that governs its
styling.
-
FormBlocSubmissionCancelled<SuccessResponse, FailureResponse>
-
It is the state that you must yield last in the method
FormBloc.onCancelingSubmission.
The previous state must be FormBlocSubmitting.
-
FormBlocSubmissionFailed<SuccessResponse, FailureResponse>
-
It is the state when the
FormBlocState._isValidByStep
is false
and FormBloc.submit is called.
-
FormBlocSubmitting<SuccessResponse, FailureResponse>
-
It is the state when the FormBloc is submitting.
It is called automatically when FormBloc.submit
is called successfully, and usually is used to
update the submission progress.
-
FormBlocSuccess<SuccessResponse, FailureResponse>
-
It is the state when the form is submitted successfully.
The previous state must be FormBlocSubmitting.
-
FormBlocUpdatingFields<SuccessResponse, FailureResponse>
-
It is the state when the form is updating the fields.
-
FormTheme
-
-
FormThemeProvider
-
-
GridGroupStyle
-
GridView
-
GroupFieldBloc<T extends FieldBloc<FieldBlocStateBase>, ExtraData>
-
-
GroupFieldBlocState<T extends FieldBloc<FieldBlocStateBase>, ExtraData>
-
-
GroupStyle
-
Base class for the style of GroupView
-
GroupView
-
You can build the layout of your items (group)
based on the style you want to apply.
-
InputFieldBloc<Value, ExtraData>
-
A
FieldBloc
used for any type, for example DateTime
or File
.
-
InputFieldBlocState<Value, ExtraData>
-
-
ListFieldBloc<T extends FieldBloc<FieldBlocStateBase>, ExtraData>
-
-
ListFieldBlocState<T extends FieldBloc<FieldBlocStateBase>, ExtraData>
-
-
ListGroupStyle
-
ListView
-
MultiBlocListener
-
Merges multiple BlocListener widgets into one widget tree.
-
MultiBlocProvider
-
Merges multiple BlocProvider widgets into one widget tree.
-
MultiFieldBloc<ExtraData, TState extends MultiFieldBlocState<ExtraData>>
-
-
MultiFieldBlocState<ExtraData>
-
-
MultiRepositoryProvider
-
Merges multiple RepositoryProvider widgets into one widget tree.
-
MultiSelectFieldBloc<Value, ExtraData>
-
A
FieldBloc
used to select multiple items
from multiple items.
-
MultiSelectFieldBlocState<Value, ExtraData>
-
-
ObscureSuffixButton
-
-
ObscureSuffixButtonTheme
-
The theme of ObscureSuffixButton
-
RadioButtonGroupFieldBlocBuilder<Value>
-
A material design radio buttons.
-
RadioFieldTheme
-
Theme of RadioButtonGroupFieldBlocBuilder
-
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.
-
ScrollableFieldBlocTarget
-
Mark the widget as a possible scroll target
-
ScrollableFieldBlocTargetState
-
-
ScrollableFormBlocManager
-
Allows you to make the first wrong child visible
-
SelectFieldBloc<Value, ExtraData>
-
A
FieldBloc
used to select one item
from multiple items.
-
SelectFieldBlocState<Value, ExtraData>
-
-
SimpleFieldBlocBuilder
-
Use these widgets:
-
SimpleMaterialStateProperty<T>
-
-
SingleFieldBloc<Value, Suggestion, State extends FieldBlocState<Value, Suggestion, ExtraData>, ExtraData>
-
The base class with the common behavior
of all single field blocs:
-
SliderFieldBlocBuilder
-
Slider
-
SliderFieldTheme
-
-
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.
-
StepperFormBlocBuilder<T extends FormBloc>
-
-
Streamable<State extends Object?>
-
An object that provides access to a stream of states over time.
-
Style
-
-
SuggestionsBoxDecoration
-
Supply an instance of this class to the
TypeAhead.suggestionsBoxDecoration
property to configure the suggestions box decoration
-
SwitchFieldBlocBuilder
-
A material design switch
-
SwitchFieldTheme
-
Theme of SwitchFieldBlocBuilder
-
TableGroupStyle
-
Similar to Table without borders or GridView without scroll
-
TextFieldBloc<ExtraData>
-
A
FieldBloc
used for String
type, but generally
it is also used to obtain int
and double
values
of texts thanks to the methods
valueToInt and valueToDouble.
-
TextFieldBlocBuilder
-
A material design text field that can show suggestions.
-
TextFieldBlocState<ExtraData>
-
-
TextFieldTheme
-
-
TextInputType
-
The type of information for which to optimize the text input control.
-
TimeFieldBlocBuilder
-
-
Transition<Event, State>
-
A Transition is the change from one state to another.
Consists of the currentState, an event, and the nextState.
-
ValidationStatus
-
-
WrapChipFieldTheme
-
The theme of ChoiceChipFieldBlocBuilder and FilterChipFieldBlocBuilder
for the chip wrap
-
WrapGroupStyle
-
Wrap
Typedefs
-
AsyncValidator<Value>
= Future<Object?> Function(Value value)
-
Signature for the AsyncValidator function which takes
value
and should returns a Object
error, and if doesn't have error
should return null
.
-
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
.
-
ChipFieldItemBuilder<T>
= ChipFieldItem Function(BuildContext context, T value)
-
-
DefaultFieldBlocErrorBuilder
= String? Function(BuildContext context, Object error, FieldBloc<FieldBlocStateBase> fieldBloc)
-
-
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.
-
FieldBlocErrorBuilder
= String? Function(BuildContext context, Object error)
-
This function take the
context
and the FieldBlocState.error
and must return a String error to display in the widget when
has an error or null if you don't want to display the error.
By default is FieldBlocBuilder.defaultErrorBuilder.
-
FieldItemBuilder<T>
= FieldItem Function(BuildContext context, T value)
-
This function takes the
context
and the value
and must return a FieldItem that represent that value
.
-
FormBlocListenerCallback<FormBlocState extends FormBlocState<SuccessResponse, ErrorResponse>, SuccessResponse, ErrorResponse>
= void Function(BuildContext context, FormBlocState state)
-
-
Suggestions<Value>
= Future<List<Value>> Function(String pattern)
-
Signature for the Suggestions function which takes
pattern
and should returns a Future
with a List<Value>
.
-
Validator<Value>
= Object? Function(Value value)
-
Signature for the Validator function which takes
value
and should returns a Object
error, and if doesn't have error
should return null
.