i'm porting a mobile App to Web, this app use the CustomPaint widget to draw based on user inputs. With RepaintBoundary i take a screenshot of the paint and save it on the device using save_in_gallery.dart package.
On the Web app the drawing part works fine, but i can't get the part of the screenshot or the part of saving the image to work. Here's the code i use to save
RenderRepaintBoundary boundary =
globalKey.currentContext.findRenderObject();
ui.Image image = await boundary.toImage();
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List();
final res = await _imageSaver.saveImage(
imageBytes: pngBytes,
directoryName: "dir_name",
);
print(res);
print(pngBytes);
}
From what i understood the dart:ui package doesn't work on Flutter Web, but i did not find any alternative. So my question is: there is a way to take an image of Custom Paint and save it as Png file on Flutter Web?