LyForm<D, E> class abstract

Implemented types
Available Extensions

Constructors

LyForm()

Properties

first LyInput
The first element.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
inputStates List<LyInputState>
no setter
isClosed bool
Whether the bloc is closed.
no setterinherited
isEmpty bool
Whether this collection has no elements.
no setteroverride
isNotEmpty bool
Whether this collection has at least one element.
no setteroverride
iterator Iterator<LyInput>
A new Iterator that allows iterating the elements of this Iterable.
no setteroverride
last LyInput
The last element.
no setteroverride
length int
The number of elements in this.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single LyInput
Checks that this iterable has only one element, and returns that element.
no setteroverride
state LyFormState<D, E>
The current state.
no setterinherited
stream Stream<LyFormState<D, E>>
The current stream of states.
no setterinherited

Methods

add(LyFormEvent event) → void
Notifies the Bloc of a new event which triggers all corresponding EventHandler instances.
inherited
addError(Object error, [StackTrace? stackTrace]) → void
Reports an error which triggers onError with an optional StackTrace.
inherited
addInput(int index, LyInput input) → void
Add an input to the form. index is the index where the input will be added. input is the input to add.
addInputs(List<LyInput> inputs) → void
Add inputs to the form. inputs is the inputs to add.
any(bool test(LyInput element)) bool
Checks whether any element of this iterable satisfies test.
override
cast<R>() Iterable<R>
A view of this iterable as an iterable of R instances.
override
change(String? debugName) → void
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.
contains(Object? element) bool
Whether the collection contains an element equal to element.
override
elementAt(int index) LyInput
Returns the indexth element.
override
emit(LyFormState<D, E> state) → void
emit is only for internal use and should never be called directly outside of tests. The Emitter instance provided to each EventHandler should be used instead.
inherited
error(E error) LyFormErrorState<D, E>
every(bool test(LyInput element)) bool
Checks whether every element of this iterable satisfies test.
override
expand<T>(Iterable<T> toElements(LyInput element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
override
firstWhere(bool test(LyInput element), {LyInput orElse()?}) LyInput
The first element that satisfies the given predicate test.
override
fold<T>(T initialValue, T combine(T previousValue, LyInput element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
override
followedBy(Iterable<LyInput> other) Iterable<LyInput>
Creates the lazy concatenation of this iterable and other.
override
forEach(void action(LyInput element)) → void
Invokes action on each element of this iterable in iteration order.
override
invalid() LyFormInvalidState<D, E>
isInvalid() bool
isPure() bool
Are every input Pure?
isValid() bool
Are every input Valid?
join([String separator = '']) String
Converts each element to a String and concatenates the strings.
override
lastWhere(bool test(LyInput element), {LyInput orElse()?}) LyInput
The last element that satisfies the given predicate test.
override
loading() LyFormLoadingState<D, E>
map<T>(T toElement(LyInput e)) Iterable<T>
The current elements of this iterable modified by toElement.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<E extends Event>(EventHandler<E, LyFormState<D, E>> handler, {EventTransformer<E>? transformer}) → void
Register event handler for an event of type E. There should only ever be one event handler per event type E.
inherited
onAddInputEvent(LyFormAddInputEvent event, Emitter<LyFormState<D, E>> emit) Future<void>
Called when the form is added an input.
onAddInputsEvent(LyFormAddInputsEvent event, Emitter<LyFormState<D, E>> emit) Future<void>
Called when the form is started.
onChange(Change<LyFormState<D, E>> 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
onChangedEvent(Emitter<LyFormState<D, E>> emit) Future<void>
Called when the form is changed.
onError(Object error, StackTrace stackTrace) → void
Called whenever an error occurs and notifies BlocObserver.onError.
inherited
onErrorState(LyFormErrorState<D, E> state) → void
Called when the form transitions to the LyFormErrorState.
onEvent(LyFormEvent event) → void
Called whenever an event is added to the Bloc. A great spot to add logging/analytics at the individual Bloc level.
inherited
onInvalidState(LyFormInvalidState<D, E> state) → void
Called when the form transitions to the LyFormInvalidState.
onLoadingState(LyFormLoadingState<D, E> state) → void
Called when the form transitions to the LyFormLoadingState.
onPureState(LyFormPureState<D, E> state) → void
Called when the form transitions to the LyFormPureState.
onRemoveInputEvent(LyFormRemoveInputEvent event, Emitter<LyFormState<D, E>> emit) Future<void>
Called when the form is removed an input.
onResetEvent(Emitter<LyFormState<D, E>> emit) Future<void>
Called when the form is reset.
onSubmit() Stream<LyFormState<D, E>>
onSubmitEvent(Emitter<LyFormState<D, E>> emit) Future<void>
Called when the form is submitted.
onSuccessState(LyFormSuccessState<D, E> state) → void
Called when the form transitions to the LyFormSuccessState.
onTransition(Transition<LyFormEvent, LyFormState<D, E>> transition) → void
Called whenever a transition occurs with the given transition. A transition occurs when a new event is added and a new state is emitted from a corresponding EventHandler.
onValidState(LyFormValidState<D, E> state) → void
Called when the form transitions to the LyFormValidState.
pure() LyFormPureState<D, E>
reduce(LyInput combine(LyInput value, LyInput element)) LyInput
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
override
removeInput(int index) → void
Remove an input from the form. index is the index where the input will be removed.
reset() → void
Reset form
singleWhere(bool test(LyInput element), {LyInput orElse()?}) LyInput
The single element that satisfies test.
override
skip(int count) Iterable<LyInput>
Creates an Iterable that provides all but the first count elements.
override
skipWhile(bool test(LyInput value)) Iterable<LyInput>
Creates an Iterable that skips leading elements while test is satisfied.
override
submit() → void
Submit form
success(D data) LyFormSuccessState<D, E>
take(int count) Iterable<LyInput>
Creates a lazy iterable of the count first elements of this iterable.
override
takeWhile(bool test(LyInput value)) Iterable<LyInput>
Creates a lazy iterable of the leading elements satisfying test.
override
toList({bool growable = true}) List<LyInput>
Creates a List containing the elements of this Iterable.
override
toSet() Set<LyInput>
Creates a Set containing the same elements as this iterable.
override
toString() String
A string representation of this object.
inherited
valid() LyFormValidState<D, E>
validate() FutureOr<void>
Validate all inputs and return true if they all are valids.
where(bool test(LyInput element)) Iterable<LyInput>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
override
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
override

Operators

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