TextFieldBloc<ExtraData> class

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.

Inheritance

Constructors

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

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<String>
Returns Stream of selected Suggestions.
no setterinherited
state TextFieldBlocState<ExtraData?>
The current state.
no setterinherited
stream Stream<TextFieldBlocState<ExtraData?>>
The current stream of states.
no setterinherited
value String
Returns the value of the current state.
no setterinherited
valueToDouble double?
Return the parsed value to double of the current state.
no setter
valueToInt int?
Return the parsed value to int of the current state.
no setter

Methods

addAsyncValidators(List<AsyncValidator<String>> 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<String>> validators, {bool forceValidation = false}) → void
Add validators to the current validators for check if value of the current state has an error.
inherited
changeValue(String value) → void
inherited
clear() → void
Set the value to initialValue of the current state.
inherited
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(TextFieldBlocState<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<TextFieldBlocState<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(TextFieldBlocState<ExtraData?> previous, TextFieldBlocState<ExtraData?> current)?, required Stream<R> onData(TextFieldBlocState<ExtraData?> previous, TextFieldBlocState<ExtraData?> current), void onFinish(TextFieldBlocState<ExtraData?> previous, TextFieldBlocState<ExtraData?> current, R result)?}) StreamSubscription
Returns a StreamSubscription<R>,
inherited
removeAsyncValidators(List<AsyncValidator<String>> 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<String>> 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(String 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<String>> 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(String value) → void
Set value to the value and set isInitial to true of the current state.
inherited
updateStateError({required String value, required Object? error}) → void
inherited
updateSuggestions(Suggestions<String>? suggestions) → void
Updates the suggestions of the current state.
inherited
updateValidators(List<Validator<String>> validators, {bool forceValidation = false}) → void
Updates the current validators with validators.
inherited
updateValue(String 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