fold<C> method

C fold<C>(
  1. C onLeft(
    1. L l
    ),
  2. C onRight(
    1. R r
    )
)

Execute onLeft when value is Left, otherwise execute onRight.

Same as match.

Implementation

C fold<C>(C Function(L l) onLeft, C Function(R r) onRight) =>
    match<C>(onLeft, onRight);