RxCommandSync<TParam, TResult> class
Implementation of RxCommand to handle async handler functions. Normally you will not instantiate this directly but use one of the factory methods of RxCommand.
- Inheritance
-
- Object
- Stream<
TResult> - StreamView<
TResult> - RxCommand<
TParam, TResult> - RxCommandSync
Constructors
Properties
-
canExecute
→ Stream<
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 Commandno setterinherited -
first
→ Future<
TResult> -
The first element of this stream.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isBroadcast → bool
-
Whether this stream is a broadcast stream.
no setterinherited
-
isEmpty
→ Future<
bool> -
Whether this stream contains any elements.
no setterinherited
-
isExecuting
→ Stream<
bool> -
Observable stream that issues a bool on any execution state change of the command
no setterinherited
-
last
→ Future<
TResult> -
The last element of this stream.
no setterinherited
- lastResult ↔ TResult?
-
The result of the last successful call to execute. This is especially handy to use as
initialData
of FlutterStreamBuilder
getter/setter pairinherited -
length
→ Future<
int> -
The number of elements in this stream.
no setterinherited
-
next
→ Future<
TResult> -
This property is a utility which allows us to chain RxCommands together.
no setterinherited
-
results
→ Stream<
CommandResult< TParam, TResult> > -
emits
CommandResult<TRESULT>
the combined state of the command, which is often easier in combination with FlutterStreamBuilder
because you have all state information at one place.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
single
→ Future<
TResult> -
The single element of this stream.
no setterinherited
- throwExceptions ↔ bool
-
By default
RxCommand
will catch all exceptions during execution of the command. And publish them on.thrownExceptions
and in theCommandResult
. If don't want this and have exceptions thrown, set this to true.getter/setter pairinherited - thrownExceptions → Stream
-
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 rethrownno setterinherited
Methods
-
any(
bool test(TResult element)) → Future< bool> -
Checks whether
test
accepts any element provided by this stream.inherited -
asBroadcastStream(
{void onListen(StreamSubscription< TResult> subscription)?, void onCancel(StreamSubscription<TResult> subscription)?}) → Stream<TResult> -
Returns a multi-subscription stream that produces the same events as this.
inherited
-
asyncExpand<
E> (Stream< E> ? convert(TResult event)) → Stream<E> -
Transforms each element into a sequence of asynchronous events.
inherited
-
asyncMap<
E> (FutureOr< E> convert(TResult event)) → Stream<E> -
Creates a new stream with each data event of this stream asynchronously
mapped to a new event.
inherited
-
call(
[TParam? param]) → void -
This makes RxCommand a callable class, so instead of
myCommand.execute()
you can writemyCommand()
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 -
dispose(
) → void -
If you don't need a command any longer it is a good practise to
dispose it to make sure all stream subscriptions are cancelled to prevent memory leaks
inherited
-
distinct(
[bool equals(TResult previous, TResult next)?]) → Stream< TResult> -
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< TResult> -
Returns the value of the
index
th data event of this stream.inherited -
every(
bool test(TResult element)) → Future< bool> -
Checks whether
test
accepts all elements provided by this stream.inherited -
execute(
[TParam? param]) → void -
Calls the wrapped handler function with an option input parameter
override
-
expand<
S> (Iterable< S> convert(TResult element)) → Stream<S> -
Transforms each element of this stream into a sequence of elements.
inherited
-
firstWhere(
bool test(TResult element), {TResult orElse()?}) → Future< TResult> -
Finds the first element of this stream matching
test
.inherited -
fold<
S> (S initialValue, S combine(S previous, TResult element)) → Future< S> -
Combines a sequence of values by repeatedly applying
combine
.inherited -
forEach(
void action(TResult element)) → Future< void> -
Executes
action
on each element of this stream.inherited -
handleError(
Function onError, {bool test(dynamic error)?}) → Stream< TResult> -
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(TResult element), {TResult orElse()?}) → Future< TResult> -
Finds the last element in this stream matching
test
.inherited -
listen(
void onData(TResult value)?, {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription< TResult> -
Adds a subscription to this stream.
inherited
-
map<
S> (S convert(TResult event)) → Stream< S> -
Transforms each element of this stream into a new stream event.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pipe(
StreamConsumer< TResult> streamConsumer) → Future -
Pipes the events of this stream into
streamConsumer
.inherited -
reduce(
TResult combine(TResult previous, TResult element)) → Future< TResult> -
Combines a sequence of values by repeatedly applying
combine
.inherited -
singleWhere(
bool test(TResult element), {TResult orElse()?}) → Future< TResult> -
Finds the single element in this stream matching
test
.inherited -
skip(
int count) → Stream< TResult> -
Skips the first
count
data events from this stream.inherited -
skipWhile(
bool test(TResult element)) → Stream< TResult> -
Skip data events from this stream while they are matched by
test
.inherited -
take(
int count) → Stream< TResult> -
Provides at most the first
count
data events of this stream.inherited -
takeWhile(
bool test(TResult element)) → Stream< TResult> -
Forwards data events while
test
is successful.inherited -
timeout(
Duration timeLimit, {void onTimeout(EventSink< TResult> sink)?}) → Stream<TResult> -
Creates a new stream with the same events as this stream.
inherited
-
toList(
) → Future< List< TResult> > -
Collects all elements of this stream in a
List
.inherited -
toSet(
) → Future< Set< TResult> > -
Collects the data of this stream in a
Set
.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
transform<
S> (StreamTransformer< TResult, S> streamTransformer) → Stream<S> -
Applies
streamTransformer
to this stream.inherited -
where(
bool test(TResult event)) → Stream< TResult> -
Creates a new stream from this stream that discards some elements.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited