of static method

Returns either the TestableRenderController from an ancestor TestRunner instance, or this will return the default controller if no TestRunner is available.

Implementation

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

  try {
    var runner = TestRunner.of(context)!;
    result = runner.testableRenderController;
  } catch (e, stack) {
    _logger.severe('Error getting the controller from the context', e, stack);
  }
  result ??= _defaultInstance;

  return result;
}