CommandResult<TParam, TResult> class

Combined execution state of a Command represented using four of its fields. A CommandResult will be issued for any state change of any of its fields During normal command execution you will get this items by listening at the command's .results ValueListenable.

  1. If the command was just newly created you will get param data, null, null, false (paramData, data, error, isRunning)
  2. When calling run: param data, null, null, true
  3. When execution finishes: param data, the result, null, false param data is the data that you pass as parameter when calling the command
Available extensions

Constructors

CommandResult(TParam? paramData, TResult? data, Object? error, bool isRunning, {ErrorReaction? errorReaction, StackTrace? stackTrace, bool isUndoValue = false})
const
CommandResult.blank()
const
CommandResult.data(TParam? param, TResult data)
const
CommandResult.error(TParam? param, dynamic error, ErrorReaction errorReaction, StackTrace? stackTrace)
const
CommandResult.isLoading([TParam? param])
const

Properties

data → TResult?
final
error → Object?
final
errorReaction → ErrorReaction?
final
hasData → bool
no setter
hasError → bool
no setter
hashCode → int
The hash code for this object.
no setteroverride
isExecuting → bool
Deprecated: Use isRunning instead. This getter will be removed in v10.0.0.
no setter
isRunning → bool
final
isSuccess → bool
if a CommandResult is not running and has no error, it is considered successful if the command has no return value, this can be used to check if the command was executed successfully
no setter
isUndoValue → bool
final
paramData → TParam?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace → StackTrace?
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override
toWidget({Widget onData(TResult result, TParam? param)?, Widget onSuccess(TParam? param)?, Widget onNullData(TParam? param)?, Widget whileRunning(TResult? lastResult, TParam? param)?, Widget whileExecuting(TResult? lastResult, TParam? param)?, Widget onError(Object error, TResult? lastResult, TParam? param)?}) → Widget

Available on CommandResult<TParam, TResult>, provided by the ToWidgeCommandResult extension

Operators

operator ==(Object other) → bool
The equality operator.
override