invokeSafelyWith<T, A> static method

Future<T?> invokeSafelyWith<T, A>(
  1. FutureOr<T> action(
    1. A arg
    ),
  2. A arg
)

Invokes the given function safely. By safely, we mean it will catch all exceptions and ignore them.

Implementation

static Future<T?> invokeSafelyWith<T, A>(FutureOr<T> action(A arg), A arg) async {
  try {
    return await action(arg);
  } catch (_) {
  }
}