FormBloc<SuccessResponse, FailureResponse> class
abstract
The base class for all FormBlocs.
See complex examples here: https://github.com/dukanitech/bloc_form/tree/master/packages/flutter_bloc_form/example/lib/forms
- Inheritance
-
- Object
- BlocBase<
FormBlocState< SuccessResponse, FailureResponse> > - Cubit<
FormBlocState< SuccessResponse, FailureResponse> > - FormBloc
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ FormBlocState<
SuccessResponse, FailureResponse> -
The current state.
no setterinherited
-
stream
→ Stream<
FormBlocState< SuccessResponse, FailureResponse> > -
The current stream of states.
no setterinherited
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
errorwhich triggers onError with an optional StackTrace.inherited -
addFieldBloc(
{int step = 0, required FieldBloc< FieldBlocStateBase> fieldBloc}) → void -
Adds
fieldBlocto the FormBloc. -
addFieldBlocs(
{int step = 0, required List< FieldBloc< fieldBlocs}) → voidFieldBlocStateBase> > -
Adds
fieldBlocsto the FormBloc. -
cancelSubmission(
) → void -
Call onCancelingSubmission if state is FormBlocSubmitting
and FormBlocSubmitting.isCanceling is
false. -
clear(
) → void -
Call
clearmethod for each FieldBloc inFieldBlocs. -
close(
) → Future< void> -
Closes the instance.
This method should be called when the instance is no longer needed.
Once close is called, the instance can no longer be used.
override
-
delete(
) → void - Call onDeleting and set the current state to FormBlocDeleting.
-
emit(
FormBlocState< SuccessResponse, FailureResponse> state) → void -
Updates the
stateto the providedstate. emit does nothing if thestatebeing emitted is equal to the currentstate.inherited -
emitDeleteFailed(
{FailureResponse? failureResponse}) → void - Update the state of the form bloc to FormBlocDeleteFailed.
-
emitDeleteSuccessful(
{SuccessResponse? successResponse}) → void - Update the state of the form bloc to FormBlocDeleteSuccessful.
-
emitFailure(
{FailureResponse? failureResponse}) → void - Update the state of the form bloc to FormBlocFailure.
-
emitLoaded(
) → void - Update the state of the form bloc to FormBlocLoaded.
-
emitLoadFailed(
{FailureResponse? failureResponse}) → void - Update the state of the form bloc to FormBlocLoadFailed.
-
emitLoading(
{double progress = 0.0}) → void - Update the state of the form bloc to FormBlocLoading.
-
emitSubmissionCancelled(
) → void - Update the state of the form bloc to FormBlocSubmissionCancelled.
-
emitSubmitting(
{double? progress}) → void - Update the state of the form bloc to FormBlocSubmitting.
-
emitSuccess(
{SuccessResponse? successResponse, bool? canSubmitAgain, bool? isEditing}) → void - Update the state of the form bloc to FormBlocSuccess.
-
emitUpdatingFields(
{double? progress}) → void -
Update the state of the form bloc
to
FormUpdatingFields. -
hasInitialValues(
{int? step}) → bool - Check if all field blocs and their children have initial values
-
hasUpdatedValues(
{int? step}) → bool - Check if all field blocs and their children have updated values
-
isValuesChanged(
{int? step}) → bool - Check if all field blocs and their children have undergone a change in values
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCancelingSubmission(
) → FutureOr< void> -
This method is called when the FormBlocState
is FormBlocSubmitting and
CancelSubmissionFormBlocis dispatched. -
onChange(
Change< FormBlocState< change) → voidSuccessResponse, FailureResponse> > -
Called whenever a
changeoccurs with the givenchange. Achangeoccurs when a newstateis emitted. onChange is called before thestateof thecubitis updated. onChange is a great spot to add logging/analytics for a specificcubit.inherited -
onDeleting(
) → FutureOr< void> - This method is called when delete is called.
-
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
erroroccurs and notifies BlocObserver.onError.inherited -
onLoading(
) → FutureOr< void> -
This method is called when the FormBloc
is instantiated and
isLoadingistrue. -
onSubmitting(
) → FutureOr< void> -
This method is called when FormBlocState.isValid is
trueand submit was called and FormBlocState.canSubmit istrue. -
previousStep(
) → void -
reload(
) → void - Call onLoading and set the current state to FormBlocLoading.
-
removeFieldBloc(
{int? step, required FieldBloc< FieldBlocStateBase> fieldBloc}) → void - Removes a FieldBloc from the FormBloc
-
removeFieldBlocs(
{int? step, required List< FieldBloc< fieldBlocs}) → voidFieldBlocStateBase> > -
Removes a
FieldBlocsfrom the FormBloc -
submit(
) → void -
Submit the form, if FormBlocState.canSubmit is
trueandFormBlocState._isValidByStepistrueonSubmitting will be called. -
toString(
) → String -
A string representation of this object.
override
-
updateCurrentStep(
int step) → void -
Update FormBlocState.currentStep only if
stepis valid by calling FormBlocState.isValid
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited