execute method

  1. @override
Future<bool> execute(
  1. Tester tester
)
override

Called when it executes the action in a flow file.

Implementation

@override
Future<bool> execute(Tester tester) async {
  final boundary = tester.getRenderRepaintBoundary();
  if (boundary == null) {
    return false;
  }

  final image = await boundary.toImage(
    pixelRatio: pixelRatio ?? tester.mediaQuery.devicePixelRatio,
  );
  final byteData = await image.toByteData(format: ImageByteFormat.png);
  final pngBytes = byteData!.buffer.asUint8List();
  await tester.storeFile(path, pngBytes);

  return true;
}