catches<A extends Object> function

A? catches<A extends Object>(
  1. Func0<A?> a
)

Catches all exceptions and returns null in case of an exception.

Implementation

A? catches<A extends Object>(Func0<A?> a) {
  try {
    return a();
  } on Exception {
    return null;
  }
}