registerException function Null safety

void registerException (
  1. Object error,
  2. [StackTrace stackTrace = StackTrace.empty]
)

Registers an exception that was caught for the current test.

Implementation

void registerException(Object error,
    [StackTrace stackTrace = StackTrace.empty]) {
  // This will usually forward directly to [Invoker.current.handleError], but
  // going through the zone API allows other zones to consistently see errors.
  Zone.current.handleUncaughtError(error, stackTrace);
}