InputFieldBloc<Value, ExtraData> class
A FieldBloc
used for any type, for example DateTime
or File
.
- Inheritance
-
- Object
- SingleFieldBloc<
Value, Value, InputFieldBlocState< Value, ExtraData> , ExtraData?> - InputFieldBloc
Constructors
-
InputFieldBloc({String? name, required Value initialValue, List<
Validator< ? validators, List<Value> >AsyncValidator< ? asyncValidators, Duration asyncValidatorDebounceTime = const Duration(milliseconds: 500), Suggestions<Value> >Value> ? suggestions, dynamic toJson(Value value)?, ExtraData? extraData}) - InputFieldBloc<Value, ExtraData>
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasInitialValue → bool
-
Indicate if this field has value from
FieldBloc.updateInitialValue
method. FieldBlocState.hasInitialValueno setterinherited - hasUpdatedValue → bool
-
Indicate if this field has value from
FieldBloc.updateValue
method. FieldBlocState.hasUpdatedValueno setterinherited - isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- isValueChanged → bool
-
Returns true when the value has been changed by
FieldBloc.changeValue
. FieldBlocState.isValueChangedno setterinherited - name → String
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selectedSuggestion
→ Stream<
Value> -
Returns Stream of selected
Suggestion
s.no setterinherited -
state
→ InputFieldBlocState<
Value, ExtraData> -
The current state.
no setterinherited
-
stream
→ Stream<
InputFieldBlocState< Value, ExtraData> > -
The current stream of states.
no setterinherited
- value → Value
-
Returns the
value
of the current state.no setterinherited
Methods
-
addAsyncValidators(
List< AsyncValidator< asyncValidators, {bool forceValidation = false}) → voidValue> > -
Add
asyncValidators
to the currentvalidators
for check ifvalue
of the current state has an error.inherited -
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
error
which triggersonError
with an optional StackTrace.inherited -
addFieldError(
Object error, {bool isPermanent = false}) → void -
If
isPermanent
isfalse
, add an error to FieldBlocState.error.inherited -
addValidators(
List< Validator< validators, {bool forceValidation = false}) → voidValue> > -
Add
validators
to the currentvalidators
for check ifvalue
of the current state has an error.inherited -
changeValue(
Value value) → void -
inherited
-
clear(
) → void -
Set the
value
toinitialValue
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(
InputFieldBlocState< Value, ExtraData> state) → void -
Updates the
state
to the providedstate
.emit
does nothing if thestate
being emitted is equal to the currentstate
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< InputFieldBlocState< change) → voidValue, ExtraData> > -
Called whenever a
change
occurs with the givenchange
. Achange
occurs when a newstate
is emitted.onChange
is called before thestate
of thecubit
is updated.onChange
is a great spot to add logging/analytics for a specificcubit
.inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
error
occurs and notifiesBlocObserver.onError
.inherited -
onValueChanges<
R> ({Duration debounceTime = const Duration(), void onStart(InputFieldBlocState< Value, ExtraData> previous, InputFieldBlocState<Value, ExtraData> current)?, required Stream<R> onData(InputFieldBlocState<Value, ExtraData> previous, InputFieldBlocState<Value, ExtraData> current), void onFinish(InputFieldBlocState<Value, ExtraData> previous, InputFieldBlocState<Value, ExtraData> current, R result)?}) → StreamSubscription -
Returns a StreamSubscription<R>,
inherited
-
removeAsyncValidators(
List< AsyncValidator< asyncValidators, {bool forceValidation = false}) → voidValue> > -
Add
asyncValidators
to the currentvalidators
for check ifvalue
of the current state has an error.inherited -
removeFormBloc(
FormBloc formBloc) → void -
Remove the
formBloc
to the fieldBloc See FieldBloc.removeFormBlocinherited -
removeValidators(
List< Validator< validators, {bool forceValidation = false}) → voidValue> > -
Add
validators
to the currentvalidators
for check ifvalue
of the current state has an error.inherited -
resetStateIsValidated(
) → void -
inherited
-
selectSuggestion(
Value suggestion) → void -
Add a
suggestion
to selectedSuggestion.inherited -
subscribeToFieldBlocs(
List< FieldBloc< fieldBlocs) → voidFieldBlocStateBase> > -
Create a subscription to the state of each
fieldBloc
inFieldBlocs
, When any state changes, thisfieldBloc
will be revalidated. This is useful when you havevalidators
that uses the state of otherfieldBloc
, for example when you want the correct behavior of validator that confirms a password with the password of otherfieldBloc
.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
updateAsyncValidators(
List< AsyncValidator< asyncValidators, {bool forceValidation = false}) → voidValue> > -
Updates the current
asyncValidators
withasyncValidators
.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
andautoValidate
to the fieldBloc See FieldBloc.updateFormBlocinherited -
updateInitialValue(
Value value) → void -
Set
value
to thevalue
and setisInitial
totrue
of the current state.inherited -
updateStateError(
{required Value value, required Object? error}) → void -
inherited
-
updateSuggestions(
Suggestions< Value> ? suggestions) → void -
Updates the
suggestions
of the current state.inherited -
updateValidators(
List< Validator< validators, {bool forceValidation = false}) → voidValue> > -
Updates the current
validators
withvalidators
.inherited -
updateValue(
Value value) → void -
Set
value
to thevalue
of the current state.inherited -
validate(
) → Future< bool> -
Check the value of the current state in each
validator
and if have an error, theerror
of the current state will be updated.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited