Compose<Input, Output> class
Compose a series of functions, the output of the previous function in the chain is automatically passed as input to the next function in the chain.
int x2(int a) => a * 2;
/// Compose one input 1️⃣
final compose1 = const Compose(x2, 2).c1(x2);
Used to compose functions with only one input of type Input
.
If the function has more than one input, use Compose2, Compose3
(coming soon), etc.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
c1<
ComposedOutput> (ComposedOutput c1Compose(Output output)) → Compose< Input, ComposedOutput> -
Chain a function that takes the output
Output
from this Compose and returns a new Compose that when called will executec1Compose
, returning a value of typeComposedOutput
. -
c2<
ComposedInput, ComposedOutput> (ComposedOutput c2Compose(Output output, ComposedInput composedInput), ComposedInput c2Input) → _ChainCompose12< Input, Output, ComposedInput, ComposedOutput> - Chain a function that takes two inputs:
-
call(
) → Output - Compute the result of the chain.
-
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 *(
Compose< Input, Output> other(Output output)) → Compose<Input, Output> -
Chain two Compose. The second Compose must have the same
Input
andOutput
of the first. -
operator ==(
Object other) → bool -
The equality operator.
inherited