fold<T> method

T fold<T>(
  1. T onFalse(),
  2. T onTrue()
)

Pattern matching on bool. Execute onFalse when the value is false, otherwise execute onTrue.

Same as match.

Implementation

T fold<T>(T Function() onFalse, T Function() onTrue) =>
    match(onFalse, onTrue);