Call class
Creates an Effect description that instructs the middleware to call the function fn with args and namedArgs as arguments.
-
fn is a Generator function, or normal function which returns a Future as result, or any other value.
-
args and namedArgs are values to be passed as arguments to fn
-
Catch will be invoked for uncaught errors.
-
Finally will be invoked in any case after call.
-
name is an optional name for the task meta.
Notes
fn can be either a normal or a Generator function.
The middleware invokes the function and examines its result.
If the result is an Iterator object, the middleware will run that Generator function, just like it did with the startup Generators (passed to the middleware on startup). The parent Generator will be suspended until the child Generator terminates normally, in which case the parent Generator is resumed with the value returned by the child Generator. Or until the child aborts with some error, in which case an error will be thrown inside the parent Generator.
If fn is a normal function and returns a Future, the middleware will suspend the Generator until the Future is settled. After the future is resolved the Generator is resumed with the resolved value, or if the Future is rejected an error is thrown inside the Generator.
If the result is not an Iterator object nor a Future, the middleware will immediately return that value back to the saga, so that it can resume its execution synchronously.
When an error is thrown, if it has a Try block surrounding the
current yield
instruction, the control will be passed to the Catch block. Otherwise,
the Generator aborts with the raised error, and if this Generator was called by another
Generator, the error will propagate to the calling Generator.
Constructors
Properties
- args → List?
-
Arguments of the function to call
final
- Catch → Function?
-
A Generator function or a normal function to invoke for uncaught errors.
final
- Finally → Function?
-
A Generator function or a normal function to invoke in any case after call.
final
- fn → Function
-
A Generator function or a normal function to call.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String?
-
Meta name of function
final
-
namedArgs
→ Map<
Symbol, dynamic> ? -
Named arguments of the function to call
final
- result ↔ Result?
-
Result after effect is resolved.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getDefinition(
) → Map< String, dynamic> -
Returns all properties of effect as a dictionary object
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited