JsonSchemaBloc class
- Inheritance
- Implemented types
-
Constructors
-
JsonSchemaBloc({@required BuildContext formContext, VoidCallback onFormChanged, WillPopCallback onFormWillPop })
-
Methods
-
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 and will result in an error being passed to onError.
In addition, if close is called while events
are still being processed,
the bloc
will continue to process the pending events
to completion.
-
getFieldStream(String fieldName)
→ Stream
-
-
getFormData()
→ String
-
-
getPropertySchema(String fieldName)
→ JsonSchema
-
-
initDataBinding(Map<String, dynamic> properties)
→ void
-
-
mapEventToState(JsonSchemaEvent event)
→ Stream<JsonSchemaState>
-
Must be implemented when a class extends
bloc
.
Takes the incoming event
as the argument.
mapEventToState is called whenever an event
is added.
mapEventToState must convert that event
into a new state
and return the new state in the form of a Stream<State>
.
-
onClicked(String event)
→ void
-
override
-
validate()
→ bool
-
-
add(JsonSchemaEvent 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 delegated to the onError method which can be overriden at the bloc
as well as the BlocDelegate
level.
inherited
-
any(bool test(T element))
→ Future<bool>
-
Checks whether
test
accepts any element provided by this stream. [...]
inherited
-
asBroadcastStream({void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscription<T> subscription) })
→ Stream<JsonSchemaState>
-
Returns a multi-subscription stream that produces the same events as this. [...]
inherited
-
asyncExpand<E>(Stream<E> convert(T event))
→ Stream<E>
-
Transforms each element into a sequence of asynchronous events. [...]
inherited
-
asyncMap<E>(FutureOr<E> convert(T 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
-
contains(Object needle)
→ Future<bool>
-
Returns whether
needle
occurs in the elements provided by this stream. [...]
inherited
-
distinct([bool equals(T previous, T next) ])
→ Stream<JsonSchemaState>
-
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<JsonSchemaState>
-
Returns the value of the
index
th data event of this stream. [...]
inherited
-
every(bool test(T element))
→ Future<bool>
-
Checks whether
test
accepts all elements provided by this stream. [...]
inherited
-
expand<S>(Iterable<S> convert(T element))
→ Stream<S>
-
Transforms each element of this stream into a sequence of elements. [...]
inherited
-
firstWhere(bool test(T element), { JsonSchemaState orElse() })
→ Future<JsonSchemaState>
-
Finds the first element of this stream matching
test
. [...]
inherited
-
fold<S>(S initialValue, S combine(S previous, T element))
→ Future<S>
-
Combines a sequence of values by repeatedly applying
combine
. [...]
inherited
-
forEach(void action(T element))
→ Future
-
Executes
action
on each element of this stream. [...]
inherited
-
handleError(Function onError, { bool test(dynamic error) })
→ Stream<JsonSchemaState>
-
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(T element), { JsonSchemaState orElse() })
→ Future<JsonSchemaState>
-
Finds the last element in this stream matching
test
. [...]
inherited
-
listen(void onData(State value), { Function onError, void onDone(), bool cancelOnError })
→ StreamSubscription<JsonSchemaState>
-
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(T event))
→ Stream<S>
-
Transforms each element of this stream into a new stream event. [...]
inherited
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a non-existent method or property is accessed. [...]
inherited
-
onError(Object error, StackTrace stacktrace)
→ void
-
Called whenever an
error
is thrown within mapEventToState.
By default all error
s 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.
inherited
-
onEvent(JsonSchemaEvent event)
→ void
-
Called whenever an
event
is added to the bloc
.
A great spot to add logging/analytics at the individual bloc
level.
inherited
-
onTransition(Transition<JsonSchemaEvent, JsonSchemaState> 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.
inherited
-
pipe(StreamConsumer<JsonSchemaState> streamConsumer)
→ Future
-
Pipes the events of this stream into
streamConsumer
. [...]
inherited
-
reduce(JsonSchemaState combine(T previous, T element))
→ Future<JsonSchemaState>
-
Combines a sequence of values by repeatedly applying
combine
. [...]
inherited
-
singleWhere(bool test(T element), { JsonSchemaState orElse() })
→ Future<JsonSchemaState>
-
Finds the single element in this stream matching
test
. [...]
inherited
-
skip(int count)
→ Stream<JsonSchemaState>
-
Skips the first
count
data events from this stream. [...]
inherited
-
skipWhile(bool test(T element))
→ Stream<JsonSchemaState>
-
Skip data events from this stream while they are matched by
test
. [...]
inherited
-
take(int count)
→ Stream<JsonSchemaState>
-
Provides at most the first
count
data events of this stream. [...]
inherited
-
takeWhile(bool test(T element))
→ Stream<JsonSchemaState>
-
Forwards data events while
test
is successful. [...]
inherited
-
timeout(Duration timeLimit, { void onTimeout(EventSink<T> sink) })
→ Stream<JsonSchemaState>
-
Creates a new stream with the same events as this stream. [...]
inherited
-
toList()
→ Future<List<JsonSchemaState>>
-
Collects all elements of this stream in a
List
. [...]
inherited
-
toSet()
→ Future<Set<JsonSchemaState>>
-
Collects the data of this stream in a
Set
. [...]
inherited
-
toString()
→ String
-
Returns a string representation of this object.
inherited
-
transform<S>(StreamTransformer<JsonSchemaState, S> streamTransformer)
→ Stream<S>
-
Applies
streamTransformer
to this stream. [...]
inherited
-
transformEvents(Stream<JsonSchemaEvent> events, Stream<JsonSchemaState> next(Event event))
→ Stream<JsonSchemaState>
-
Transforms the
events
stream along with a next
function into a Stream<State>
.
Events that should be processed by mapEventToState need to be passed to next
.
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
-
transformStates(Stream<JsonSchemaState> states)
→ Stream<JsonSchemaState>
-
Transforms the
Stream<State>
into a new Stream<State>
.
By default transformStates returns the incoming Stream<State>
.
You can override transformStates for advanced usage
in order to manipulate the frequency and specificity at which transitions
(state changes)
occur. [...]
inherited
-
where(bool test(T event))
→ Stream<JsonSchemaState>
-
Creates a new stream from this stream that discards some elements. [...]
inherited
Operators
-
operator ==(dynamic other)
→ bool
-
The equality operator. [...]
inherited