evaluate method

  1. @override
Future<Evaluation> evaluate(
  1. WidgetTester tester

Evaluate whether the current state of the tester conforms to the rule.


Future<Evaluation> evaluate(WidgetTester tester) async {
  Evaluation result = const Evaluation.pass();
  for (final FlutterView view in tester.platformDispatcher.views) {
    // TODO(pdblasi): This renderView will need to be retrieved from view when available.
    final RenderView renderView = tester.binding.renderView;
    final OffsetLayer layer = renderView.debugLayer! as OffsetLayer;
    final SemanticsNode root = renderView.owner!.semanticsOwner!.rootSemanticsNode!;

    late ui.Image image;
    final ByteData? byteData = await tester.binding.runAsync<ByteData?>(
      () async {
        // Needs to be the same pixel ratio otherwise our dimensions won't match
        // the last transform layer.
        final double ratio = 1 / view.devicePixelRatio;
        image = await layer.toImage(renderView.paintBounds, pixelRatio: ratio);
        return image.toByteData();

    result += await _evaluateNode(root, tester, image, byteData!, view);

  return result;