BooleanFieldBloc<ExtraData> class

A FieldBloc used for bool type.

Inheritance

Constructors

BooleanFieldBloc({String? name, bool initialValue = false, List<Validator<bool>>? validators, List<AsyncValidator<bool>>? asyncValidators, Duration asyncValidatorDebounceTime = const Duration(milliseconds: 500), Suggestions<bool>? suggestions, ExtraData? extraData})
BooleanFieldBloc

Properties

hashCode int
The hash code for this object.
no setterinherited
hasInitialValue bool
Indicate if this field has value from FieldBloc.updateInitialValue method. FieldBlocState.hasInitialValue
no setterinherited
hasUpdatedValue bool
Indicate if this field has value from FieldBloc.updateValue method. FieldBlocState.hasUpdatedValue
no setterinherited
isClosed bool
Whether the bloc is closed.
no setterinherited
isValueChanged bool
Returns true when the value has been changed by FieldBloc.changeValue. FieldBlocState.isValueChanged
no setterinherited
name String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedSuggestion Stream<bool>
Returns Stream of selected Suggestions.
no setterinherited
state BooleanFieldBlocState<ExtraData>
The current state.
no setterinherited
stream Stream<BooleanFieldBlocState<ExtraData>>
The current stream of states.
no setterinherited
value bool
Returns the value of the current state.
no setterinherited

Methods

addAsyncValidators(List<AsyncValidator<bool>> asyncValidators, {bool forceValidation = false}) → void
Add asyncValidators to the current validators for check if value of the current state has an error.
inherited
addError(Object error, [StackTrace? stackTrace]) → void
Reports an error which triggers onError with an optional StackTrace.
inherited
addFieldError(Object error, {bool isPermanent = false}) → void
If isPermanent is false, add an error to FieldBlocState.error.
inherited
addValidators(List<Validator<bool>> validators, {bool forceValidation = false}) → void
Add validators to the current validators for check if value of the current state has an error.
inherited
changeValue(bool value) → void
inherited
clear() → void
Set the value to false of the current state.
override
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.
inherited
emit(BooleanFieldBlocState<ExtraData> state) → void
Updates the state to the provided state. emit does nothing if the state being emitted is equal to the current state.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onChange(Change<BooleanFieldBlocState<ExtraData>> 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
onError(Object error, StackTrace stackTrace) → void
Called whenever an error occurs and notifies BlocObserver.onError.
inherited
onValueChanges<R>({Duration debounceTime = const Duration(), void onStart(BooleanFieldBlocState<ExtraData> previous, BooleanFieldBlocState<ExtraData> current)?, required Stream<R> onData(BooleanFieldBlocState<ExtraData> previous, BooleanFieldBlocState<ExtraData> current), void onFinish(BooleanFieldBlocState<ExtraData> previous, BooleanFieldBlocState<ExtraData> current, R result)?}) StreamSubscription
Returns a StreamSubscription<R>,
inherited
removeAsyncValidators(List<AsyncValidator<bool>> asyncValidators, {bool forceValidation = false}) → void
Add asyncValidators to the current validators for check if value of the current state has an error.
inherited
removeFormBloc(FormBloc formBloc) → void
Remove the formBloc to the fieldBloc See FieldBloc.removeFormBloc
inherited
removeValidators(List<Validator<bool>> validators, {bool forceValidation = false}) → void
Add validators to the current validators for check if value of the current state has an error.
inherited
resetStateIsValidated() → void
inherited
selectSuggestion(bool suggestion) → void
Add a suggestion to selectedSuggestion.
inherited
subscribeToFieldBlocs(List<FieldBloc<FieldBlocStateBase>> fieldBlocs) → void
Create a subscription to the state of each fieldBloc in FieldBlocs, When any state changes, this fieldBloc will be revalidated. This is useful when you have validators that uses the state of other fieldBloc, for example when you want the correct behavior of validator that confirms a password with the password of other fieldBloc.
inherited
toString() String
A string representation of this object.
inherited
updateAsyncValidators(List<AsyncValidator<bool>> asyncValidators, {bool forceValidation = false}) → void
Updates the current asyncValidators with asyncValidators.
inherited
updateExtraData(ExtraData? extraData) → void
{@template form_bloc.FieldBloc.updateExtraData} Updates the extraData of the current state. {@endtemplate form_bloc.FieldBloc.updateExtraData}
inherited
updateFormBloc(FormBloc formBloc, {bool autoValidate = false}) → void
Update the formBloc and autoValidate to the fieldBloc See FieldBloc.updateFormBloc
inherited
updateInitialValue(bool value) → void
Set value to the value and set isInitial to true of the current state.
inherited
updateStateError({required bool value, required Object? error}) → void
inherited
updateSuggestions(Suggestions<bool>? suggestions) → void
Updates the suggestions of the current state.
inherited
updateValidators(List<Validator<bool>> validators, {bool forceValidation = false}) → void
Updates the current validators with validators.
inherited
updateValue(bool value) → void
Set value to the value of the current state.
inherited
validate() Future<bool>
Check the value of the current state in each validator and if have an error, the error of the current state will be updated.
inherited

Operators

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