ignoreExceptions function

FutureOr<bool> ignoreExceptions(
  1. FutureOr action()
)

Run the given action ignoring any Exceptions thrown by it. Returns true if the action succeeded, false otherwise.

Implementation

FutureOr<bool> ignoreExceptions(FutureOr Function() action) async {
  try {
    await action();
    return true;
  } on Exception {
    // ignore
    return false;
  }
}