InputFieldBloc<Value, ExtraData> class
A FieldBloc
used for any type, for example DateTime
or File
.
- Inheritance
- Object
- Stream<
InputFieldBlocState< Value, ExtraData> > - Cubit<
InputFieldBlocState< Value, ExtraData> > - Bloc<
FieldBlocEvent, InputFieldBlocState< Value, ExtraData> > - SingleFieldBloc<
Value, Value, InputFieldBlocState< Value, ExtraData> , ExtraData> - InputFieldBloc
- Available Extensions
- BufferExtensions
- ConcatExtensions
- ConnectableStreamExtensions
- DebounceExtensions
- DefaultIfEmptyExtension
- DelayExtension
- DistinctUniqueExtension
- DoExtensions
- EndWithExtension
- EndWithManyExtension
- ExhaustMapExtension
- FlatMapExtension
- GroupByExtension
- IgnoreElementsExtension
- IntervalExtension
- MapToExtension
- MaterializeExtension
- MaxExtension
- MergeExtension
- MinExtension
- OnErrorExtensions
- PairwiseExtension
- SampleExtensions
- ScanExtension
- SkipUntilExtension
- StartWithExtension
- StartWithManyExtension
- SwitchIfEmptyExtension
- SwitchMapExtension
- TakeUntilExtension
- TakeWhileInclusiveExtension
- ThrottleExtensions
- TimeIntervalExtension
- TimeStampExtension
- WhereTypeExtension
- WindowExtensions
- WithLatestFromExtensions
- ZipWithExtension
Constructors
-
InputFieldBloc({String name, 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
-
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
Suggestion
s. [...]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< asyncValidators) → voidValue> > -
Add
asyncValidators
to the currentvalidators
for check ifvalue
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
isfalse
, add an error to FieldBlocState.error. [...]inherited -
addValidators(
List< Validator< validators) → voidValue> > -
Add
validators
to the currentvalidators
for check ifvalue
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< subscription), void onCancel(StreamSubscription<Value, ExtraData> >InputFieldBlocState< subscription)}) → Stream<Value, ExtraData> >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
tonull
of the current state.inherited -
close(
) → Future< void> -
Closes the
event
andstate
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 whileevents
are still being processed, the Bloc will finish processing the pendingevents
.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
index
th 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 theStream<State>
using the providedonData
,onError
andonDone
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 thatevent
into a new state. mapEventToState canyield
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< 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
. [...]@mustCallSuper, inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
error
is thrown within mapEventToState. By default allerror
s will be ignored and Bloc functionality will be unaffected. ThestackTrace
argument may benull
if the state stream received an error without astackTrace
. 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< transition) → voidValue, ExtraData> > -
Called whenever a
transition
occurs with the giventransition
. Atransition
occurs when a newevent
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< streamConsumer) → FutureValue, ExtraData> > -
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
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 -
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< sink)}) → Stream<Value, ExtraData> >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< streamTransformer) → Stream<Value, ExtraData> , S>S> -
Applies
streamTransformer
to this stream. [...]inherited -
transformEvents(
Stream< FieldBlocEvent> events, TransitionFunction<FieldBlocEvent, InputFieldBlocState< transitionFn) → Stream<Value, ExtraData> >Transition< FieldBlocEvent, InputFieldBlocState< >Value, ExtraData> > -
Transforms the
events
stream along with atransitionFn
function into aStream<Transition>
. Events that should be processed by mapEventToState need to be passed totransitionFn
. By defaultasyncExpand
is used to ensure allevents
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 whichevents
are processed. [...]inherited -
transformTransitions(
Stream< Transition< transitions) → Stream<FieldBlocEvent, InputFieldBlocState< >Value, ExtraData> >Transition< FieldBlocEvent, InputFieldBlocState< >Value, ExtraData> > -
Transforms the
Stream<Transition>
into a newStream<Transition>
. By default transformTransitions returns the incomingStream<Transition>
. You can override transformTransitions for advanced usage in order to manipulate the frequency and specificity at whichtransitions
(state changes) occur. [...]inherited -
updateAsyncValidators(
List< AsyncValidator< asyncValidators) → voidValue> > -
Updates the current
asyncValidators
withasyncValidators
.inherited -
updateExtraData(
ExtraData extraData) → void -
Updates the
extraData
of the current state.inherited -
updateInitialValue(
Value value) → void -
Set
value
to thevalue
and setisInitial
totrue
of the current state.inherited -
updateSuggestions(
Suggestions< Value> suggestions) → void -
Updates the
suggestions
of the current state.inherited -
updateValidators(
List< Validator< validators) → voidValue> > -
Updates the current
validators
withvalidators
.inherited -
updateValue(
Value value) → void -
Set
value
to thevalue
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