screenshotAsBase64 function
Prints screenshot in the console as base 64 strings.
The image can then be decoded with tools like this one.
Implementation
Future<void> screenshotAsBase64(
BuildContext context,
DeviceScreenshot screenshot,
) async {
var result = base64.encode(screenshot.bytes);
final timestamp = DateTime.now().millisecondsSinceEpoch;
log('Screenshot ${screenshot.device.identifier} $timestamp (also in clipboard) -> $result');
await Clipboard.setData(
ClipboardData(text: result),
);
}