screenshot method

Future<CommandAck> screenshot(
  1. DeviceCommand command
)

Implementation

Future<CommandAck> screenshot(
  DeviceCommand command,
) async {
  CommandAck result;

  if (kIsWeb) {
    result = CommandAck(
      commandId: command.id,
      message: '[${command.type}]: not supported on Web',
      success: false,
    );
  } else {
    final screenshot =
        await (_driver.testController!.screencap() as FutureOr<Uint8List>);
    result = CommandAck(
      commandId: command.id,
      response: ScreenshotResponse(image: screenshot),
      success: true,
    );
  }

  return result;
}