Combined execution state of an RxCommand
-Will be issued for any statechange of any of the fields
+Will be issued for any state change of any of the fields
During normal command execution you will get this items listening at the command's .results observable.
-
If the command was just newly created you will get null, false, false (data, error, isExecuting)
-
When calling execute: null, false, true
-
When exceution finishes: the result, false, false
+
If the command was just newly created you will get null, null, false (data, error, isExecuting)
All objects have hash codes.
The default hash code represents only the identity of the object,
-the same way as the default operator == implementation only considers objects
+the same way as the default operator == implementation only considers objects
equal if they are identical (see identityHashCode).
-
If operator == is overridden to use the object state instead,
+
If operator == is overridden to use the object state instead,
the hash code must also be changed to represent that state.
Hash codes must be the same for objects that are equal to each other
-according to operator ==.
+according to operator ==.
The hash code of an object should only change if the object changes
in a way that affects equality.
There are no further requirements for the hash codes.
@@ -115,8 +119,8 @@
CommandResult class
it is even technically allowed that all instances have the same hash code,
but if clashes happen too often, it may reduce the efficiency of hash-based
data structures like HashSet or HashMap.
-
If a subclass overrides hashCode, it should override the
-operator == operator as well to maintain consistency.
+
If a subclass overrides hashCode, it should override the
+operator == operator as well to maintain consistency.
MockCommand allows you to easily moch an RxCommand for your Unit and UI tests
+
MockCommand allows you to easily mock an RxCommand for your Unit and UI tests
Mocking a command with mockitohttps://pub.dartlang.org/packages/mockito has its limitations.
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
- The result of the last sucessful call to execute. This is especialls handy to use as initialData of Flutter Streambuilder
+ The result of the last successful call to execute. This is especially handy to use as initialData of Flutter StreamBuilder
- emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
+ emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
because you have all state information at one place.
- By default RxCommand will catch all exceptions during exceution of the command. And publish them on .thrownExceptions
+ By default RxCommand will catch all exceptions during execution 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.
When subribing to thrownExceptionsyou will every excetpion that was thrown in your handler function as an event on this Observable.
@@ -279,370 +320,370 @@
- For a more fine grained control to simulate the different states of an RxCommand
-there are these functions
-startExecution will issue a CommandResult with
-data: null
-error: null
-isExecuting : true
-
-
- Returns a multi-subscription stream that produces the same events as this. [...]
+ Returns a multi-subscription stream that produces the same events as this. [...]
- This makes RxCommand a callable class, so instead of myCommand.exceute() you can write myCommand()
+ This makes RxCommand a callable class, so instead of myCommand.execute() you can write myCommand()
- Returns whether needle occurs in the elements provided by this stream. [...]
+ Returns whether needle occurs in the elements provided by this stream. [...]
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
+dispose it to make sure all stream subscriptions are cancelled to prevent memory leaks
- Transforms each element of this stream into a sequence of elements. [...]
+ Transforms each element of this stream into a sequence of elements. [...]
- Creates a wrapper Stream that intercepts some errors from this stream. [...]
+ Creates a wrapper Stream that intercepts some errors from this stream. [...]
- Combines the string representation of elements into a single string. [...]
+ Combines the string representation of elements into a single string. [...]
+ For a more fine grained control to simulate the different states of an RxCommand
+there are these functions
+startExecution will issue a CommandResult with
+data: null
+error: null
+isExecuting : true
+
For a more fine grained control to simulate the different states of an RxCommand
+
For a more fine grained control to simulate the different states of an RxCommand
there are these functions
-startExecution will issue a CommandResult with
+startExecution will issue a CommandResult with
data: null
error: null
isExecuting : true
RxCommand capsules a given handler function that can then be executed by its execute method.
+
RxCommand capsules a given handler function that can then be executed by its execute method.
The result of this method is then published through its Observable (Observable wrap Dart Streams)
Additionally it offers Observables for it's current execution state, if the command can be executed and for
all possibly thrown exceptions during command execution.
-
RxCommand implements the Observable interface so you can listen directly to the RxCommand which emits the
+
RxCommand implements the Observable interface so you can listen directly to the RxCommand which emits the
results of the wrapped function. If this function has a void return type
it will still output one void item so that you can listen for the end of the execution.
-
The results Observable emits CommandResult<TRESULT> which is often easier in combaination with Flutter StreamBuilder
+
The results Observable emits CommandResult<TRESULT> which is often easier in combination with Flutter StreamBuilder
because you have all state information at one place.
-
An RxCommand is a generic class of type RxCommand<TParam, TRESULT>
-where TParam is the type of data that is passed when calling execute and
+
An RxCommand is a generic class of type RxCommand<TParam, TRESULT>
+where TParam is the type of data that is passed when calling execute and
TResult denotes the return type of the handler function. To signal that
a handler doesn't take a parameter or returns no value use the type void
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
- emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
-because you have all state information at one place.
-
- 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.
-
- When subribing to thrownExceptionsyou 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
-
+ emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
+because you have all state information at one place.
+
+ By default RxCommand will catch all exceptions during execution 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.
+
+ When subribing to thrownExceptionsyou 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
+
- 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
-
-
- Returns a multi-subscription stream that produces the same events as this. [...]
+ Returns a multi-subscription stream that produces the same events as this. [...]
- Returns whether needle occurs in the elements provided by this stream. [...]
+ Returns whether needle occurs in the elements provided by this stream. [...]
+ 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
+
- Transforms each element of this stream into a sequence of elements. [...]
+ Transforms each element of this stream into a sequence of elements. [...]
- Creates a wrapper Stream that intercepts some errors from this stream. [...]
+ Creates a wrapper Stream that intercepts some errors from this stream. [...]
- Combines the string representation of elements into a single string. [...]
+ Combines the string representation of elements into a single string. [...]
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-for the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+for the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
Creates a RxCommand from an "one time" observable. This is handy if used together with a streame generator function.
-provider: provider function that returns a Observable that will be subscribed on the call of execute
+provider: provider function that returns a Observable that will be subscribed on the call of executecanExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
@@ -195,18 +195,17 @@
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-for the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+for the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
@@ -195,18 +195,17 @@
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
@@ -185,18 +185,17 @@
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
@@ -186,18 +186,17 @@
Creates a RxCommand from an "one time" observable. This is handy if used together with a streame generator function.
-provider: provider function that returns a Observable that will be subscribed on the call of execute
+provider: provider function that returns a Observable that will be subscribed on the call of executecanExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
@@ -195,18 +195,17 @@
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
@@ -195,18 +195,17 @@
func: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+emitLastResult will include the value of the last successful execution in all CommandResult events unless there is no result.
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
-initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
-lastResult as initialData of a StreamBuilder
+initialLastResult sets the value of the lastResult property before the first item was received. This is helpful if you use
+lastResult as initialData of a StreamBuilder
@@ -194,18 +194,17 @@
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
@@ -185,18 +185,17 @@
action: handler function
canExecute : observable that can be used to enable/disable the command based on some other state change
if omitted the command can be executed always except it's already executing
-isExecuting will issue a bool value on each state change. Even if you
+isExecuting will issue a bool value on each state change. Even if you
subscribe to a newly created command it will issue false
-For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
-if you want to get an initial Result with data==null, error==null, isExceuting==false pass
+For the Observable<CommandResult> that RxCommand publishes in results this normally doesn't make sense
+if you want to get an initial Result with data==null, error==null, isExecuting==false pass
emitInitialCommandResult=true.
-By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
+By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like
a BehaviourSubject, meaning every listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.
@@ -186,18 +186,17 @@
emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
+
emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
because you have all state information at one place.
By default RxCommand will catch all exceptions during exceution of the command. And publish them on .thrownExceptions
+
By default RxCommand will catch all exceptions during execution 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.
- The result of the last sucessful call to execute. This is especialls handy to use as initialData of Flutter Streambuilder
+ The result of the last successful call to execute. This is especially handy to use as initialData of Flutter StreamBuilder
- emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
+ emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
because you have all state information at one place.
- By default RxCommand will catch all exceptions during exceution of the command. And publish them on .thrownExceptions
+ By default RxCommand will catch all exceptions during execution 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.
When subribing to thrownExceptionsyou will every excetpion that was thrown in your handler function as an event on this Observable.
@@ -251,308 +292,308 @@
- Returns a multi-subscription stream that produces the same events as this. [...]
+ Returns a multi-subscription stream that produces the same events as this. [...]
- This makes RxCommand a callable class, so instead of myCommand.exceute() you can write myCommand()
+ This makes RxCommand a callable class, so instead of myCommand.execute() you can write myCommand()
- Returns whether needle occurs in the elements provided by this stream. [...]
+ Returns whether needle occurs in the elements provided by this stream. [...]
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
+dispose it to make sure all stream subscriptions are cancelled to prevent memory leaks
- Transforms each element of this stream into a sequence of elements. [...]
+ Transforms each element of this stream into a sequence of elements. [...]
- Creates a wrapper Stream that intercepts some errors from this stream. [...]
+ Creates a wrapper Stream that intercepts some errors from this stream. [...]
- Combines the string representation of elements into a single string. [...]
+ Combines the string representation of elements into a single string. [...]
- The result of the last sucessful call to execute. This is especialls handy to use as initialData of Flutter Streambuilder
+ The result of the last successful call to execute. This is especially handy to use as initialData of Flutter StreamBuilder
- emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
+ emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
because you have all state information at one place.
- By default RxCommand will catch all exceptions during exceution of the command. And publish them on .thrownExceptions
+ By default RxCommand will catch all exceptions during execution 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.
When subribing to thrownExceptionsyou will every excetpion that was thrown in your handler function as an event on this Observable.
@@ -251,308 +292,308 @@
- Returns a multi-subscription stream that produces the same events as this. [...]
+ Returns a multi-subscription stream that produces the same events as this. [...]
- This makes RxCommand a callable class, so instead of myCommand.exceute() you can write myCommand()
+ This makes RxCommand a callable class, so instead of myCommand.execute() you can write myCommand()
- Returns whether needle occurs in the elements provided by this stream. [...]
+ Returns whether needle occurs in the elements provided by this stream. [...]
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
+dispose it to make sure all stream subscriptions are cancelled to prevent memory leaks
- Transforms each element of this stream into a sequence of elements. [...]
+ Transforms each element of this stream into a sequence of elements. [...]
- Creates a wrapper Stream that intercepts some errors from this stream. [...]
+ Creates a wrapper Stream that intercepts some errors from this stream. [...]
- Combines the string representation of elements into a single string. [...]
+ Combines the string representation of elements into a single string. [...]
Implementation of RxCommand to handle async handler functions. Normally you will not instanciate this directly but use one of the factory
+
Implementation of RxCommand to handle async handler functions. Normally you will not instantiate this directly but use one of the factory
methods of RxCommand.
- The result of the last sucessful call to execute. This is especialls handy to use as initialData of Flutter Streambuilder
+ The result of the last successful call to execute. This is especially handy to use as initialData of Flutter StreamBuilder
- emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
+ emits CommandResult<TRESULT> the combined state of the command, which is often easier in combination with Flutter StreamBuilder
because you have all state information at one place.
- By default RxCommand will catch all exceptions during exceution of the command. And publish them on .thrownExceptions
+ By default RxCommand will catch all exceptions during execution 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.
When subribing to thrownExceptionsyou will every excetpion that was thrown in your handler function as an event on this Observable.
@@ -255,308 +296,308 @@
- Returns a multi-subscription stream that produces the same events as this. [...]
+ Returns a multi-subscription stream that produces the same events as this. [...]
- This makes RxCommand a callable class, so instead of myCommand.exceute() you can write myCommand()
+ This makes RxCommand a callable class, so instead of myCommand.execute() you can write myCommand()
- Returns whether needle occurs in the elements provided by this stream. [...]
+ Returns whether needle occurs in the elements provided by this stream. [...]
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
+dispose it to make sure all stream subscriptions are cancelled to prevent memory leaks
- Transforms each element of this stream into a sequence of elements. [...]
+ Transforms each element of this stream into a sequence of elements. [...]
- Creates a wrapper Stream that intercepts some errors from this stream. [...]
+ Creates a wrapper Stream that intercepts some errors from this stream. [...]
- Combines the string representation of elements into a single string. [...]
+ Combines the string representation of elements into a single string. [...]
Combined execution state of an RxCommand
-Will be issued for any statechange of any of the fields
-During normal command execution you will get this items listening at the command's .results observable. [...]
+Will be issued for any state change of any of the fields
+During normal command execution you will get this items listening at the command's .results observable. [...]
- MockCommand allows you to easily moch an RxCommand for your Unit and UI tests
+ MockCommand allows you to easily mock an RxCommand for your Unit and UI tests
Mocking a command with mockitohttps://pub.dartlang.org/packages/mockito has its limitations.
- RxCommand capsules a given handler function that can then be executed by its execute method.
+ RxCommand capsules a given handler function that can then be executed by its execute method.
The result of this method is then published through its Observable (Observable wrap Dart Streams)
Additionally it offers Observables for it's current execution state, if the command can be executed and for
-all possibly thrown exceptions during command execution. [...]
+all possibly thrown exceptions during command execution. [...]
- Implementation of RxCommand to handle async handler functions. Normally you will not instanciate this directly but use one of the factory
+ Implementation of RxCommand to handle async handler functions. Normally you will not instantiate this directly but use one of the factory
methods of RxCommand.
All objects have hash codes.
The default hash code represents only the identity of the object,
-the same way as the default operator == implementation only considers objects
+the same way as the default operator == implementation only considers objects
equal if they are identical (see identityHashCode).
-
If operator == is overridden to use the object state instead,
+
If operator == is overridden to use the object state instead,
the hash code must also be changed to represent that state.
Hash codes must be the same for objects that are equal to each other
-according to operator ==.
+according to operator ==.
The hash code of an object should only change if the object changes
in a way that affects equality.
There are no further requirements for the hash codes.
@@ -126,8 +127,8 @@
RxCommandListener class
it is even technically allowed that all instances have the same hash code,
but if clashes happen too often, it may reduce the efficiency of hash-based
data structures like HashSet or HashMap.
-
If a subclass overrides hashCode, it should override the
-operator == operator as well to maintain consistency.
+
If a subclass overrides hashCode, it should override the
+operator == operator as well to maintain consistency.