CPS class

Creates an Effect description that instructs the middleware to invoke fn as a Node style function.

  • fn is a Node style function. i.e. a function which accepts in addition to its arguments, an additional callback to be invoked by fn when it terminates. The callback accepts two parameters, where the first parameter is used to report errors while the second is used to report successful results.

  • args and namedArgs are values to be passed as arguments to fn

Notes

The middleware will perform a call fn(args:[args],namedArgs:[namedArgs], cb). The cb is a callback passed by the middleware to fn. If fn terminates normally, it must call cb(res: result) to notify the middleware of a successful result. If fn encounters some error, then it must call cb(err: error) in order to notify the middleware that an error has occurred.

The middleware remains suspended until fn terminates.

Inheritance

Constructors

CPS(Function fn, {List? args, Map<Symbol, dynamic>? namedArgs, String? name, Result? result})
Creates an instance of a CPS effect.

Properties

args List?
Arguments of the function to 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