findResult<T> static method

T? findResult<T>({
  1. required List<Func<T>?> checks,
  2. T? exclude,
})

Implementation

static T? findResult<T>({required List<Func<T>?> checks, T? exclude}) {
  for (var check in checks) {
    if (check == null) continue;
    final result = check();
    if (result != null && (exclude != null && result != exclude)) {
      return result;
    }
  }
  return null;
}