Skip to content

Function2Ops<T0, T1, T2>

extension Function2Ops<T0, T1, T2> on T2 Function(T0, T1)

Provides additional functions on functions with 2 parameters.

Properties

curried extension no setter

T2 Function(T1) Function(T0) get curried

Return the curried form of this function.

Available on Function2<T0, T1, T2>, provided by the Function2Ops<T0, T1, T2> extension

Implementation
dart
Function2C<T0, T1, T2> get curried => (t0) => (t1) => this(t0, t1);

tupled extension no setter

T2 Function(Record) get tupled

Returns a function that takes a tuple of parameters rather than individual parameters.

Available on Function2<T0, T1, T2>, provided by the Function2Ops<T0, T1, T2> extension

Implementation
dart
Function1<(T0, T1), T2> get tupled => (t) => t(this);

Methods

andThen() extension

T3 Function(T0, T1) andThen<T3>(T3 Function(T2) fn)

Composes this function with the provided function, this function being applied first.

Available on Function2<T0, T1, T2>, provided by the Function2Ops<T0, T1, T2> extension

Implementation
dart
Function2<T0, T1, T3> andThen<T3>(Function1<T2, T3> fn) => (t0, t1) => fn(this(t0, t1));

compose() extension

T2 Function(T3) compose<T3>(Record Function(T3) fn)

Composes this function with the provided function, this function being applied first.

Available on Function2<T0, T1, T2>, provided by the Function2Ops<T0, T1, T2> extension

Implementation
dart
Function1<T3, T2> compose<T3>(Function1<T3, (T0, T1)> fn) => (t3) => tupled(fn(t3));