fold<R> method

R fold<R>(
  1. R match1(
    1. T1
    ),
  2. R match2(
    1. T2
    ),
  3. R match3(
    1. T3
    ),
  4. R match4(
    1. T4
    ),
)

Implementation

R fold<R>(
  R Function(T1) match1,
  R Function(T2) match2,
  R Function(T3) match3,
  R Function(T4) match4,
) {
  switch (_discriminator) {
    case 0:
      return match1(_value1 as T1);
    case 1:
      return match2(_value2 as T2);
    case 2:
      return match3(_value3 as T3);
    default:
      return match4(_value4 as T4);
  }
}