compose<T, M, R> function

R Function(T) compose<T, M, R>(
  1. R f(
    1. M
    ),
  2. M g(
    1. T
    )
)

Returns the mathematical composition f(g(x)): applies g first, then f.

Example:

final f = compose<int, int, String>((m) => 'v$m', (t) => t + 1);
f(2); // 'v3'

Implementation

R Function(T) compose<T, M, R>(R Function(M) f, M Function(T) g) =>
    (T x) => f(g(x));