evaluate method Null safety

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

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

Implementation

@override
Future<Evaluation> evaluate(WidgetTester tester) async {
  final SemanticsNode root = tester.binding.pipelineOwner.semanticsOwner!.rootSemanticsNode!;
  final RenderView renderView = tester.binding.renderView;
  final OffsetLayer layer = renderView.debugLayer! as OffsetLayer;

  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 / tester.binding.window.devicePixelRatio;
      image = await layer.toImage(renderView.paintBounds, pixelRatio: ratio);
      return image.toByteData();
    },
  );

  return _evaluateNode(root, tester, image, byteData!);
}