current property Null safety

TestHandle current

Returns handle for the currently running test.

This must be called from within the zone that the test is running in. If the current zone is not a test's zone throws OutsideTestException.

Implementation

static TestHandle get current {
  final invoker = Invoker.current;
  if (invoker == null) throw OutsideTestException();
  return TestHandle._(
      invoker, StackTraceFormatter.current ?? _defaultFormatter);
}