of static method

TestController? of(
  1. BuildContext context
)

Returns the TestController provided by the widget tree. This will never throw an exception but may return null if no controller is available on the widget tree.

Implementation

static TestController? of(BuildContext context) {
  TestController? result;

  try {
    final runner = TestRunner.of(context);
    result = runner?.controller;
  } catch (e) {
    // no-op
  }

  return result;
}