FormBloc<SuccessResponse, FailureResponse> class abstract

Constructors

FormBloc({bool isLoading = false, bool autoValidate = true, bool isEditing = false})

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 error which triggers onError with an optional StackTrace.
inherited
addFieldBloc({int step = 0, required FieldBloc<FieldBlocStateBase> fieldBloc}) → void
Adds fieldBloc to the FormBloc.
addFieldBlocs({int step = 0, required List<FieldBloc<FieldBlocStateBase>> fieldBlocs}) → void
Adds fieldBlocs to the FormBloc.
cancelSubmission() → void
Call onCancelingSubmission if state is FormBlocSubmitting and FormBlocSubmitting.isCanceling is false.
clear() → void
Call clear method for each FieldBloc in FieldBlocs.
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.
delete() → void
Call onDeleting and set the current state to FormBlocDeleting.
emit(FormBlocState<SuccessResponse, FailureResponse> state) → void
Updates the state to the provided state. emit does nothing if the state being emitted is equal to the current state.
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 CancelSubmissionFormBloc is dispatched.
onChange(Change<FormBlocState<SuccessResponse, FailureResponse>> change) → void
Called whenever a change occurs with the given change. A change occurs when a new state is emitted. onChange is called before the state of the cubit is updated. onChange is a great spot to add logging/analytics for a specific cubit.
inherited
onDeleting() FutureOr<void>
This method is called when delete is called.
onError(Object error, StackTrace stackTrace) → void
Called whenever an error occurs and notifies BlocObserver.onError.
inherited
onLoading() FutureOr<void>
This method is called when the FormBloc is instantiated and isLoading is true.
onSubmitting() FutureOr<void>
This method is called when FormBlocState.isValid is true and submit was called and FormBlocState.canSubmit is true.
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<FieldBlocStateBase>> fieldBlocs}) → void
Removes a FieldBlocs from the FormBloc
submit() → void
Submit the form, if FormBlocState.canSubmit is true and FormBlocState._isValidByStep is true onSubmitting will be called.
toString() String
A string representation of this object.
override
updateCurrentStep(int step) → void
Update FormBlocState.currentStep only if step is valid by calling FormBlocState.isValid

Operators

operator ==(Object other) bool
The equality operator.
inherited