tryReduce method

T? tryReduce(
  1. T combine(
    1. T,
    2. T
    )
)

Tries to reduce the iterable, returning null if it fails.

Implementation

T? tryReduce(T Function(T, T) combine) {
  try {
    return reduce(combine);
  } catch (_) {
    return null;
  }
}