InputFieldBloc<Value, ExtraData> class

A FieldBloc used for any type, for example DateTime or File.

Inheritance
Available Extensions

Constructors

InputFieldBloc({String name, Value initialValue, List<Validator<Value>> validators, List<AsyncValidator<Value>> asyncValidators, Duration asyncValidatorDebounceTime = const Duration(milliseconds: 500), Suggestions<Value> suggestions, dynamic toJson(Value value), ExtraData extraData})
InputFieldBloc<Value, ExtraData> [...]

Properties

first Future<InputFieldBlocState<Value, ExtraData>>
The first element of this stream. [...]
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
isBroadcast bool
Returns whether the Stream<State> is a broadcast stream. Every Cubit is a broadcast stream.
read-only, inherited
isEmpty Future<bool>
Whether this stream contains any elements. [...]
read-only, inherited
last Future<InputFieldBlocState<Value, ExtraData>>
The last element of this stream. [...]
read-only, inherited
length Future<int>
The number of elements in this stream. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
selectedSuggestion Stream<Value>
Returns Stream of selected Suggestions. [...]
read-only, inherited
single Future<InputFieldBlocState<Value, ExtraData>>
The single element of this stream. [...]
read-only, inherited
state InputFieldBlocState<Value, ExtraData>
The current state.
read-only, inherited
value → Value
Returns the value of the current state.
read-only, inherited

Methods

add(FieldBlocEvent event) → void
Notifies the Bloc of a new event which triggers mapEventToState. If close has already been called, any subsequent calls to add will be ignored and will not result in any subsequent state changes.
inherited
addAsyncValidators(List<AsyncValidator<Value>> asyncValidators) → 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
Notifies the Bloc of an error which triggers onError.
inherited
addFieldError(String error, {bool isPermanent = false}) → void
If isPermanent is false, add an error to FieldBlocState.error. [...]
inherited
addValidators(List<Validator<Value>> validators) → void
Add validators to the current validators for check if value of the current state has an error.
inherited
any(bool test(InputFieldBlocState<Value, ExtraData> element)) Future<bool>
Checks whether test accepts any element provided by this stream. [...]
inherited
asBroadcastStream({void onListen(StreamSubscription<InputFieldBlocState<Value, ExtraData>> subscription), void onCancel(StreamSubscription<InputFieldBlocState<Value, ExtraData>> subscription)}) Stream<InputFieldBlocState<Value, ExtraData>>
Returns a multi-subscription stream that produces the same events as this. [...]
inherited
asyncExpand<E>(Stream<E> convert(InputFieldBlocState<Value, ExtraData> event)) Stream<E>
Transforms each element into a sequence of asynchronous events. [...]
inherited
asyncMap<E>(FutureOr<E> convert(InputFieldBlocState<Value, ExtraData> event)) Stream<E>
Creates a new stream with each data event of this stream asynchronously mapped to a new event. [...]
inherited
cast<R>() Stream<R>
Adapt this stream to be a Stream<R>. [...]
inherited
clear() → void
Set the value to null of the current state.
inherited
close() Future<void>
Closes the event and state Streams. This method should be called when a Bloc is no longer needed. Once close is called, events that are added will not be processed. In addition, if close is called while events are still being processed, the Bloc will finish processing the pending events.
inherited
contains(Object needle) Future<bool>
Returns whether needle occurs in the elements provided by this stream. [...]
inherited
distinct([bool equals(InputFieldBlocState<Value, ExtraData> previous, InputFieldBlocState<Value, ExtraData> next)]) Stream<InputFieldBlocState<Value, ExtraData>>
Skips data events if they are equal to the previous data event. [...]
inherited
drain<E>([E futureValue]) Future<E>
Discards all data on this stream, but signals when it is done or an error occurred. [...]
inherited
elementAt(int index) Future<InputFieldBlocState<Value, ExtraData>>
Returns the value of the indexth data event of this stream. [...]
inherited
emit(InputFieldBlocState<Value, ExtraData> state) → void
emit should never be used outside of tests. [...]
@visibleForTesting, inherited
every(bool test(InputFieldBlocState<Value, ExtraData> element)) Future<bool>
Checks whether test accepts all elements provided by this stream. [...]
inherited
expand<S>(Iterable<S> convert(InputFieldBlocState<Value, ExtraData> element)) Stream<S>
Transforms each element of this stream into a sequence of elements. [...]
inherited
firstWhere(bool test(InputFieldBlocState<Value, ExtraData> element), {InputFieldBlocState<Value, ExtraData> orElse()}) Future<InputFieldBlocState<Value, ExtraData>>
Finds the first element of this stream matching test. [...]
inherited
fold<S>(S initialValue, S combine(S previous, InputFieldBlocState<Value, ExtraData> element)) Future<S>
Combines a sequence of values by repeatedly applying combine. [...]
inherited
forEach(void action(InputFieldBlocState<Value, ExtraData> element)) Future
Executes action on each element of this stream. [...]
inherited
handleError(Function onError, {bool test(dynamic error)}) Stream<InputFieldBlocState<Value, ExtraData>>
Creates a wrapper Stream that intercepts some errors from this stream. [...]
inherited
join([String separator = ""]) Future<String>
Combines the string representation of elements into a single string. [...]
inherited
lastWhere(bool test(InputFieldBlocState<Value, ExtraData> element), {InputFieldBlocState<Value, ExtraData> orElse()}) Future<InputFieldBlocState<Value, ExtraData>>
Finds the last element in this stream matching test. [...]
inherited
listen(void onData(InputFieldBlocState<Value, ExtraData>), {Function onError, void onDone(), bool cancelOnError}) StreamSubscription<InputFieldBlocState<Value, ExtraData>>
Adds a subscription to the Stream<State>. Returns a StreamSubscription which handles events from the Stream<State> using the provided onData, onError and onDone handlers.
inherited
map<S>(S convert(InputFieldBlocState<Value, ExtraData> event)) Stream<S>
Transforms each element of this stream into a new stream event. [...]
inherited
mapEventToState(FieldBlocEvent event) Stream<InputFieldBlocState<Value, ExtraData>>
Must be implemented when a class extends Bloc. mapEventToState is called whenever an event is added and is responsible for converting that event into a new state. mapEventToState can yield zero, one, or multiple states for an event.
@mustCallSuper, inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onChange(Change<InputFieldBlocState<Value, 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. [...]
@mustCallSuper, inherited
onError(Object error, StackTrace stackTrace) → void
Called whenever an error is thrown within mapEventToState. By default all errors will be ignored and Bloc functionality will be unaffected. The stackTrace argument may be null if the state stream received an error without a stackTrace. A great spot to handle errors at the individual Bloc level. [...]
@mustCallSuper, @protected, inherited
onEvent(FieldBlocEvent event) → void
Called whenever an event is added to the Bloc. A great spot to add logging/analytics at the individual Bloc level. [...]
@mustCallSuper, @protected, inherited
onTransition(Transition<FieldBlocEvent, InputFieldBlocState<Value, ExtraData>> transition) → void
Called whenever a transition occurs with the given transition. A transition occurs when a new event is added and mapEventToState executed. onTransition is called before a Bloc's state has been updated. A great spot to add logging/analytics at the individual Bloc level. [...]
@mustCallSuper, @protected, inherited
onValueChanges<R>({Duration debounceTime = const Duration(), void onStart(InputFieldBlocState<Value, ExtraData> previous, InputFieldBlocState<Value, ExtraData> current), 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
pipe(StreamConsumer<InputFieldBlocState<Value, ExtraData>> streamConsumer) Future
Pipes the events of this stream into streamConsumer. [...]
inherited
reduce(InputFieldBlocState<Value, ExtraData> combine(InputFieldBlocState<Value, ExtraData> previous, InputFieldBlocState<Value, ExtraData> element)) Future<InputFieldBlocState<Value, ExtraData>>
Combines a sequence of values by repeatedly applying combine. [...]
inherited
selectSuggestion(Value suggestion) → void
Add a suggestion to selectedSuggestion.
inherited
singleWhere(bool test(InputFieldBlocState<Value, ExtraData> element), {InputFieldBlocState<Value, ExtraData> orElse()}) Future<InputFieldBlocState<Value, ExtraData>>
Finds the single element in this stream matching test. [...]
inherited
skip(int count) Stream<InputFieldBlocState<Value, ExtraData>>
Skips the first count data events from this stream. [...]
inherited
skipWhile(bool test(InputFieldBlocState<Value, ExtraData> element)) Stream<InputFieldBlocState<Value, ExtraData>>
Skip data events from this stream while they are matched by test. [...]
inherited
subscribeToFieldBlocs(List<FieldBloc> 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
take(int count) Stream<InputFieldBlocState<Value, ExtraData>>
Provides at most the first count data events of this stream. [...]
inherited
takeWhile(bool test(InputFieldBlocState<Value, ExtraData> element)) Stream<InputFieldBlocState<Value, ExtraData>>
Forwards data events while test is successful. [...]
inherited
timeout(Duration timeLimit, {void onTimeout(EventSink<InputFieldBlocState<Value, ExtraData>> sink)}) Stream<InputFieldBlocState<Value, ExtraData>>
Creates a new stream with the same events as this stream. [...]
inherited
toList() Future<List<InputFieldBlocState<Value, ExtraData>>>
Collects all elements of this stream in a List. [...]
inherited
toSet() Future<Set<InputFieldBlocState<Value, ExtraData>>>
Collects the data of this stream in a Set. [...]
inherited
toString() String
Returns a string representation of this object.
inherited
transform<S>(StreamTransformer<InputFieldBlocState<Value, ExtraData>, S> streamTransformer) Stream<S>
Applies streamTransformer to this stream. [...]
inherited
transformEvents(Stream<FieldBlocEvent> events, TransitionFunction<FieldBlocEvent, InputFieldBlocState<Value, ExtraData>> transitionFn) Stream<Transition<FieldBlocEvent, InputFieldBlocState<Value, ExtraData>>>
Transforms the events stream along with a transitionFn function into a Stream<Transition>. Events that should be processed by mapEventToState need to be passed to transitionFn. By default asyncExpand is used to ensure all events are processed in the order in which they are received. You can override transformEvents for advanced usage in order to manipulate the frequency and specificity with which mapEventToState is called as well as which events are processed. [...]
inherited
transformTransitions(Stream<Transition<FieldBlocEvent, InputFieldBlocState<Value, ExtraData>>> transitions) Stream<Transition<FieldBlocEvent, InputFieldBlocState<Value, ExtraData>>>
Transforms the Stream<Transition> into a new Stream<Transition>. By default transformTransitions returns the incoming Stream<Transition>. You can override transformTransitions for advanced usage in order to manipulate the frequency and specificity at which transitions (state changes) occur. [...]
inherited
updateAsyncValidators(List<AsyncValidator<Value>> asyncValidators) → void
Updates the current asyncValidators with asyncValidators.
inherited
updateExtraData(ExtraData extraData) → void
Updates the extraData of the current state.
inherited
updateInitialValue(Value value) → void
Set value to the value and set isInitial to true of the current state.
inherited
updateSuggestions(Suggestions<Value> suggestions) → void
Updates the suggestions of the current state.
inherited
updateValidators(List<Validator<Value>> validators) → void
Updates the current validators with validators.
inherited
updateValue(Value value) → void
Set value to the value of the current state.
inherited
where(bool test(InputFieldBlocState<Value, ExtraData> event)) Stream<InputFieldBlocState<Value, ExtraData>>
Creates a new stream from this stream that discards some elements. [...]
inherited

Operators

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