RxCommandStream<TParam, TResult> class
- Inheritance
- Object
- RxCommand<TParam, TResult>
- RxCommandStream
Constructors
-
RxCommandStream(StreamProvider<TParam, TResult> provider, Observable<bool> canExecute, bool emitInitialCommandResult, bool emitLastResult, bool emitsLastValueToNewSubscriptions, TResult initialLastResult)
-
factory
Properties
-
canExecute
→ Observable<bool>
-
Observable stream that issues a bool on any change of the current executable state of the command.
Meaning if the command cann be executed or not. This will issue
false
while the command executes
but also if the command receives a false from the canExecute Observable that you can pass when creating the Command
read-only, inherited
-
first
→ AsObservableFuture<TResult>
-
The first element of this stream. [...]
read-only, inherited
-
hashCode
→ int
-
The hash code for this object. [...]
read-only, inherited
-
isBroadcast
→ bool
-
Whether this stream is a broadcast stream.
read-only, inherited
-
isEmpty
→ AsObservableFuture<bool>
-
Whether this stream contains any elements. [...]
read-only, inherited
-
isExecuting
→ Observable<bool>
-
Observable stream that issues a bool on any execution state change of the command
read-only, inherited
-
last
→ AsObservableFuture<TResult>
-
The last element of this stream. [...]
read-only, inherited
-
lastResult
↔ TResult
-
The result of the last sucessful call to execute. This is especialls handy to use as
initialData
of Flutter Streambuilder
read / write, inherited
-
length
→ AsObservableFuture<int>
-
The number of elements in this stream. [...]
read-only, inherited
-
next
→ Future<TResult>
-
This property is a utility which allows us to chain RxCommands together.
read-only, inherited
-
results
→ Observable<CommandResult<TResult>>
-
emits CommandResult<TRESULT> the combined state of the commane, which is often easier in combination with Flutter
StreamBuilder
because you have all state information at one place.
read-only, inherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
read-only, inherited
-
single
→ AsObservableFuture<TResult>
-
The single element of this stream. [...]
read-only, inherited
-
throwExceptions
↔ bool
-
By default
RxCommand
will catch all exceptions during exceution of the command. And publish them on .thrownExceptions
and in the CommandResult
. If don't want this and have exceptions thrown, set this to true.
read / write, inherited
-
thrownExceptions
→ Observable
-
When subribing to
thrownExceptions
you will every excetpion that was thrown in your handler function as an event on this Observable.
If no subscription exists the Exception will be rethrown
read-only, inherited
Methods
-
execute([TParam param ])
→ void
-
Calls the wrapped handler function with an option input parameter
override
-
any(bool test(T element))
→ AsObservableFuture<bool>
-
Checks whether
test
accepts any element provided by this stream. [...]
inherited
-
asBroadcastStream({void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscription<T> subscription) })
→ Observable<TResult>
-
Returns a multi-subscription stream that produces the same events as this. [...]
inherited
-
asyncExpand<S>(Stream<S> mapper(T value))
→ Observable<S>
-
Maps each emitted item to a new
Stream
using the given mapper, then
subscribes to each new stream one after the next until all values are
emitted. [...]
inherited
-
asyncMap<S>(FutureOr<S> convert(T value))
→ Observable<S>
-
Creates an Observable with each data event of this stream asynchronously
mapped to a new event. [...]
inherited
-
buffer(Stream window)
→ Observable<List<TResult>>
-
Creates an Observable where each item is a
List
containing the items
from the source sequence. [...]
inherited
-
bufferCount(int count, [ int startBufferEvery = 0 ])
→ Observable<List<TResult>>
-
Buffers a number of values from the source Observable by
count
then
emits the buffer and clears it, and starts a new buffer each
startBufferEvery
values. If startBufferEvery
is not provided,
then new buffers are started immediately at the start of the source
and when each buffer closes and is emitted. [...]
inherited
-
bufferTest(bool onTestHandler(T event))
→ Observable<List<TResult>>
-
Creates an Observable where each item is a
List
containing the items
from the source sequence, batched whenever test passes. [...]
inherited
-
bufferTime(Duration duration)
→ Observable<List<TResult>>
-
Creates an Observable where each item is a
List
containing the items
from the source sequence, sampled on a time frame with duration
. [...]
inherited
-
call([TParam param ])
→ void
-
This makes RxCommand a callable class, so instead of
myCommand.exceute()
you can write myCommand()
inherited
-
cast<R>()
→ Observable<R>
-
Adapt this stream to be a
Stream<R>
. [...]
inherited
-
concatMap<S>(Stream<S> mapper(T value))
→ Observable<S>
-
Maps each emitted item to a new
Stream
using the given mapper, then
subscribes to each new stream one after the next until all values are
emitted. [...]
inherited
-
concatWith(Iterable<Stream<TResult>> other)
→ Observable<TResult>
-
Returns an Observable that emits all items from the current Observable,
then emits all items from the given observable, one after the next. [...]
inherited
-
contains(Object needle)
→ AsObservableFuture<bool>
-
Returns whether
needle
occurs in the elements provided by this stream. [...]
inherited
-
debounce(Stream window(T event))
→ Observable<TResult>
-
Transforms a
Stream
so that will only emit items from the source sequence
if a window
has completed, without the source sequence emitting
another item. [...]
inherited
-
debounceTime(Duration duration)
→ Observable<TResult>
-
Transforms a
Stream
so that will only emit items from the source sequence
whenever the time span defined by duration
passes,
without the source sequence emitting another item. [...]
inherited
-
defaultIfEmpty(TResult defaultValue)
→ Observable<TResult>
-
Emit items from the source Stream, or a single default item if the source
Stream emits nothing. [...]
inherited
-
delay(Duration duration)
→ Observable<TResult>
-
The Delay operator modifies its source Observable by pausing for
a particular increment of time (that you specify) before emitting
each of the source Observable’s items.
This has the effect of shifting the entire sequence of items emitted
by the Observable forward in time by that specified increment. [...]
inherited
-
dematerialize<S>()
→ Observable<S>
-
Converts the onData, onDone, and onError
Notification
objects from a
materialized stream into normal onData, onDone, and onError events. [...]
inherited
-
dispose()
→ void
-
If you don't need a command any longer it is a good practise to
dispose it to make sure all stream subsriptions are cancelled to prevent memory leaks
inherited
-
distinct([bool equals(T previous, T next) ])
→ Observable<TResult>
-
WARNING: More commonly known as distinctUntilChanged in other Rx
implementations. Creates an Observable where data events are skipped if
they are equal to the previous data event. [...]
inherited
-
distinctUnique({bool equals(T e1, T e2), int hashCode(T e) })
→ Observable<TResult>
-
WARNING: More commonly known as distinct in other Rx implementations.
Creates an Observable where data events are skipped if they have already
been emitted before. [...]
inherited
-
doOnCancel(void onCancel())
→ Observable<TResult>
-
Invokes the given callback function when the stream subscription is
cancelled. Often called doOnUnsubscribe or doOnDispose in other
implementations. [...]
inherited
-
doOnData(void onData(T event))
→ Observable<TResult>
-
Invokes the given callback function when the stream emits an item. In
other implementations, this is called doOnNext. [...]
inherited
-
doOnDone(void onDone())
→ Observable<TResult>
-
Invokes the given callback function when the stream finishes emitting
items. In other implementations, this is called doOnComplete(d). [...]
inherited
-
doOnEach(void onEach(Notification<T> notification))
→ Observable<TResult>
-
Invokes the given callback function when the stream emits data, emits
an error, or emits done. The callback receives a
Notification
object. [...]
inherited
-
doOnError(Function onError)
→ Observable<TResult>
-
Invokes the given callback function when the stream emits an error. [...]
inherited
-
doOnListen(void onListen())
→ Observable<TResult>
-
Invokes the given callback function when the stream is first listened to. [...]
inherited
-
doOnPause(void onPause(Future resumeSignal))
→ Observable<TResult>
-
Invokes the given callback function when the stream subscription is
paused. [...]
inherited
-
doOnResume(void onResume())
→ Observable<TResult>
-
Invokes the given callback function when the stream subscription
resumes receiving items. [...]
inherited
-
drain<S>([S futureValue ])
→ AsObservableFuture<S>
-
Discards all data on this stream, but signals when it is done or an error
occurred. [...]
inherited
-
elementAt(int index)
→ AsObservableFuture<TResult>
-
Returns the value of the
index
th data event of this stream. [...]
inherited
-
every(bool test(T element))
→ AsObservableFuture<bool>
-
Checks whether
test
accepts all elements provided by this stream. [...]
inherited
-
exhaustMap<S>(Stream<S> mapper(T value))
→ Observable<S>
-
Converts items from the source stream into a new Stream using a given
mapper. It ignores all items from the source stream until the new stream
completes. [...]
inherited
-
expand<S>(Iterable<S> convert(T value))
→ Observable<S>
-
Creates an Observable from this stream that converts each element into
zero or more events. [...]
inherited
-
firstWhere(bool test(T element), { dynamic defaultValue(), TResult orElse() })
→ AsObservableFuture<TResult>
-
Finds the first element of this stream matching
test
. [...]
inherited
-
flatMap<S>(Stream<S> mapper(T value))
→ Observable<S>
-
Converts each emitted item into a new Stream using the given mapper
function. The newly created Stream will be be listened to and begin
emitting items downstream. [...]
inherited
-
flatMapIterable<S>(Stream<Iterable<S>> mapper(T value))
→ Observable<S>
-
Converts each item into a new Stream. The Stream must return an
Iterable. Then, each item from the Iterable will be emitted one by one. [...]
inherited
-
fold<S>(S initialValue, S combine(S previous, T element))
→ AsObservableFuture<S>
-
Combines a sequence of values by repeatedly applying
combine
. [...]
inherited
-
forEach(void action(T element))
→ AsObservableFuture
-
Executes
action
on each element of this stream. [...]
inherited
-
groupBy<S>(S grouper(T value))
→ Observable<GroupByObservable<TResult, S>>
-
The GroupBy operator divides an
Observable
that emits items into
an Observable
that emits GroupByObservable
,
each one of which emits some subset of the items
from the original source Observable
. [...]
inherited
-
handleError(Function onError, { bool test(dynamic error) })
→ Observable<TResult>
-
Creates a wrapper Stream that intercepts some errors from this stream. [...]
inherited
-
ignoreElements()
→ Observable<TResult>
-
Creates an Observable where all emitted items are ignored, only the
error / completed notifications are passed [...]
inherited
-
interval(Duration duration)
→ Observable<TResult>
-
Creates an Observable that emits each item in the Stream after a given
duration. [...]
inherited
-
join([String separator = "" ])
→ AsObservableFuture<String>
-
Combines the string representation of elements into a single string. [...]
inherited
-
lastWhere(bool test(T element), { Object defaultValue(), TResult orElse() })
→ AsObservableFuture<TResult>
-
Finds the last element in this stream matching
test
. [...]
inherited
-
listen(void onData(T event), { Function onError, void onDone(), bool cancelOnError })
→ StreamSubscription<TResult>
-
Adds a subscription to this stream. Returns a
StreamSubscription
which
handles events from the stream using the provided onData
, onError
and
onDone
handlers. [...]
inherited
-
map<S>(S convert(T event))
→ Observable<S>
-
Maps values from a source sequence through a function and emits the
returned values. [...]
inherited
-
mapTo<S>(S value)
→ Observable<S>
-
Emits the given constant value on the output Observable every time the source Observable emits a value. [...]
inherited
-
materialize()
→ Observable<Notification<TResult>>
-
Converts the onData, on Done, and onError events into
Notification
objects that are passed into the downstream onData listener. [...]
inherited
-
max([Comparator<TResult> comparator ])
→ AsObservableFuture<TResult>
-
Converts a Stream into a Future that completes with the largest item emitted
by the Stream. [...]
inherited
-
mergeWith(Iterable<Stream<TResult>> streams)
→ Observable<TResult>
-
Combines the items emitted by multiple streams into a single stream of
items. The items are emitted in the order they are emitted by their
sources. [...]
inherited
-
min([Comparator<TResult> comparator ])
→ AsObservableFuture<TResult>
-
Converts a Stream into a Future that completes with the smallest item
emitted by the Stream. [...]
inherited
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a non-existent method or property is accessed. [...]
inherited
-
ofType<S>(TypeToken<S> typeToken)
→ Observable<S>
-
Filters a sequence so that only events of a given type pass [...]
inherited
-
onErrorResume(Stream<TResult> recoveryFn(dynamic error))
→ Observable<TResult>
-
Intercepts error events and switches to a recovery stream created by the
provided
recoveryFn
. [...]
inherited
-
onErrorResumeNext(Stream<TResult> recoveryStream)
→ Observable<TResult>
-
Intercepts error events and switches to the given recovery stream in
that case [...]
inherited
-
onErrorReturn(TResult returnValue)
→ Observable<TResult>
-
instructs an Observable to emit a particular item when it encounters an
error, and then terminate normally [...]
inherited
-
onErrorReturnWith(TResult returnFn(dynamic error))
→ Observable<TResult>
-
instructs an Observable to emit a particular item created by the
returnFn
when it encounters an error, and then terminate normally. [...]
inherited
-
pairwise()
→ Observable<Iterable<TResult>>
-
Emits the n-th and n-1th events as a pair.. [...]
inherited
-
pipe(StreamConsumer<TResult> streamConsumer)
→ AsObservableFuture
-
Pipes the events of this stream into
streamConsumer
. [...]
inherited
-
publish()
→ ConnectableObservable<TResult>
-
Convert the current Observable into a
ConnectableObservable
that can be listened to multiple times. It will not begin emitting items
from the original Observable until the connect
method is invoked. [...]
inherited
-
publishReplay({int maxSize })
→ ReplayConnectableObservable<TResult>
-
Convert the current Observable into a
ReplayConnectableObservable
that can be listened to multiple times. It will not begin emitting items
from the original Observable until the connect
method is invoked. [...]
inherited
-
publishValue()
→ ValueConnectableObservable<TResult>
-
Convert the current Observable into a
ValueConnectableObservable
that can be listened to multiple times. It will not begin emitting items
from the original Observable until the connect
method is invoked. [...]
inherited
-
publishValueSeeded(TResult seedValue)
→ ValueConnectableObservable<TResult>
-
Convert the current Observable into a
ValueConnectableObservable
that can be listened to multiple times, providing an initial seeded value.
It will not begin emitting items from the original Observable
until the connect
method is invoked. [...]
inherited
-
reduce(TResult combine(T previous, T element))
→ AsObservableFuture<TResult>
-
Combines a sequence of values by repeatedly applying
combine
. [...]
inherited
-
sample(Stream sampleStream)
→ Observable<TResult>
-
Emits the most recently emitted item (if any)
emitted by the source
Stream
since the previous emission from
the sampleStream
. [...]
inherited
-
sampleTime(Duration duration)
→ Observable<TResult>
-
Emits the most recently emitted item (if any)
emitted by the source
Stream
since the previous emission within
the recurring time span, defined by duration
[...]
inherited
-
scan<S>(S accumulator(S accumulated, T value, int index), [ S seed ])
→ Observable<S>
-
Applies an accumulator function over an observable sequence and returns
each intermediate result. The optional seed value is used as the initial
accumulator value. [...]
inherited
-
share()
→ Observable<TResult>
-
Convert the current Observable into a new Observable that can be listened
to multiple times. It will automatically begin emitting items when first
listened to, and shut down when no listeners remain. [...]
inherited
-
shareReplay({int maxSize })
→ ReplayObservable<TResult>
-
Convert the current Observable into a new
ReplayObservable
that can
be listened to multiple times. It will automatically begin emitting items
when first listened to, and shut down when no listeners remain. [...]
inherited
-
shareValue()
→ ValueObservable<TResult>
-
Convert the current Observable into a new
ValueObservable
that can
be listened to multiple times. It will automatically begin emitting items
when first listened to, and shut down when no listeners remain. [...]
inherited
-
shareValueSeeded(TResult seedValue)
→ ValueObservable<TResult>
-
Convert the current Observable into a new
ValueObservable
that can
be listened to multiple times, providing an initial value.
It will automatically begin emitting items when first listened to,
and shut down when no listeners remain. [...]
inherited
-
singleWhere(bool test(T element), { TResult orElse() })
→ AsObservableFuture<TResult>
-
Finds the single element in this stream matching
test
. [...]
inherited
-
skip(int count)
→ Observable<TResult>
-
Skips the first count data events from this stream. [...]
inherited
-
skipUntil<S>(Stream<S> otherStream)
→ Observable<TResult>
-
Starts emitting items only after the given stream emits an item. [...]
inherited
-
skipWhile(bool test(T element))
→ Observable<TResult>
-
Skip data events from this stream while they are matched by test. [...]
inherited
-
startWith(TResult startValue)
→ Observable<TResult>
-
Prepends a value to the source Observable. [...]
inherited
-
startWithMany(List<TResult> startValues)
→ Observable<TResult>
-
Prepends a sequence of values to the source Observable. [...]
inherited
-
switchIfEmpty(Stream<TResult> fallbackStream)
→ Observable<TResult>
-
When the original observable emits no items, this operator subscribes to
the given fallback stream and emits items from that observable instead. [...]
inherited
-
switchMap<S>(Stream<S> mapper(T value))
→ Observable<S>
-
Converts each emitted item into a new Stream using the given mapper
function. The newly created Stream will be be listened to and begin
emitting items, and any previously created Stream will stop emitting. [...]
inherited
-
take(int count)
→ Observable<TResult>
-
Provides at most the first
n
values of this stream.
Forwards the first n data events of this stream, and all error events, to
the returned stream, and ends with a done event. [...]
inherited
-
takeUntil<S>(Stream<S> otherStream)
→ Observable<TResult>
-
Returns the values from the source observable sequence until the other
observable sequence produces a value. [...]
inherited
-
takeWhile(bool test(T element))
→ Observable<TResult>
-
Forwards data events while test is successful. [...]
inherited
-
throttle(Stream window(T event), { bool trailing: false })
→ Observable<TResult>
-
Emits only the first item emitted by the source
Stream
while window
is open. [...]
inherited
-
throttleTime(Duration duration, { bool trailing: false })
→ Observable<TResult>
-
Emits only the first item emitted by the source
Stream
within a time span of duration
. [...]
inherited
-
timeInterval()
→ Observable<TimeInterval<TResult>>
-
Records the time interval between consecutive values in an observable
sequence. [...]
inherited
-
timeout(Duration timeLimit, { void onTimeout(EventSink<T> sink) })
→ Observable<TResult>
-
The Timeout operator allows you to abort an Observable with an onError
termination if that Observable fails to emit any items during a specified
duration. You may optionally provide a callback function to execute on
timeout.
inherited
-
timestamp()
→ Observable<Timestamped<TResult>>
-
Wraps each item emitted by the source Observable in a
Timestamped
object
that includes the emitted item and the time when the item was emitted. [...]
inherited
-
toList()
→ AsObservableFuture<List<TResult>>
-
Collects all elements of this stream in a
List
. [...]
inherited
-
toSet()
→ AsObservableFuture<Set<TResult>>
-
Collects the data of this stream in a
Set
. [...]
inherited
-
toString()
→ String
-
Returns a string representation of this object.
inherited
-
transform<S>(StreamTransformer<TResult, S> streamTransformer)
→ Observable<S>
-
Applies
streamTransformer
to this stream. [...]
inherited
-
where(bool test(T event))
→ Observable<TResult>
-
Filters the elements of an observable sequence based on the test.
inherited
-
window(Stream window)
→ Observable<Stream<TResult>>
-
Creates an Observable where each item is a
Stream
containing the items
from the source sequence. [...]
inherited
-
windowCount(int count, [ int startBufferEvery = 0 ])
→ Observable<Stream<TResult>>
-
Buffers a number of values from the source Observable by
count
then
emits the buffer as a Stream
and clears it, and starts a new buffer each
startBufferEvery
values. If startBufferEvery
is not provided,
then new buffers are started immediately at the start of the source
and when each buffer closes and is emitted. [...]
inherited
-
windowTest(bool onTestHandler(T event))
→ Observable<Stream<TResult>>
-
Creates an Observable where each item is a
Stream
containing the items
from the source sequence, batched whenever test passes. [...]
inherited
-
windowTime(Duration duration)
→ Observable<Stream<TResult>>
-
Creates an Observable where each item is a
Stream
containing the items
from the source sequence, sampled on a time frame with duration
. [...]
inherited
-
withLatestFrom<S, R>(Stream<S> latestFromStream, R fn(T t, S s))
→ Observable<R>
-
Creates an Observable that emits when the source stream emits, combining
the latest values from the two streams using the provided function. [...]
inherited
-
zipWith<S, R>(Stream<S> other, R zipper(T t, S s))
→ Observable<R>
-
Returns an Observable that combines the current stream together with
another stream using a given zipper function. [...]
inherited
Operators
-
operator ==(dynamic other)
→ bool
-
The equality operator. [...]
inherited