Solve the issue of blackened screenshot in flutter

Job ID: 33078507

Budget: $10 – $30 USD

Hi, this is not a project as it's a little problem



I'm trying to capture QrImage using screenshot package specifically .captureFromWidget method, I'm not building the widget QrImage, because I don't want to show it just print it out using the sumni_printer package.

I tried to show the QR before printing when it was an image, and it showed flawsly as it is.
here's how it looks in the app
https://i.stack.imgur.com/5FC3E.png


here's the code:

Future<Uint8List> getQRBytes(String data) async {
QrImage qr = QrImage(
data: data,
size: 100,
);
ScreenshotController screenshotController = ScreenshotController();
Screenshot(
controller: screenshotController,
child: qr,
);
Uint8List bytes = await screenshotController.captureFromWidget(qr);
return bytes;
}

and the results when printed in sumni printer:
https://i.stack.imgur.com/sjZKg.jpg

this is how I import the Uint8List when printing:

Uint8List qr = await getQRBytes(data);
await SunmiPrinter.printImage(qr);
Related categories: Dart Flutter QR Code Making