Skip to content

Function1Ops<T0, T1>

extension Function1Ops<T0, T1> on T1 Function(T0)

Provides additional functions on functions with 1 parameters.

Methods

andThen() extension

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

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

Available on Function1<T0, T1>, provided by the Function1Ops<T0, T1> extension

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

compose() extension

T1 Function(T2) compose<T2>(T0 Function(T2) fn)

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

Available on Function1<T0, T1>, provided by the Function1Ops<T0, T1> extension

Implementation
dart
Function1<T2, T1> compose<T2>(Function1<T2, T0> fn) => (t2) => this(fn(t2));