shareAs static method

Future<void> shareAs(
  1. String title,
  2. String message,
  3. Uint8List bytes,
  4. RenderBox? box, {
  5. int quality = 100,
  6. Size? size,
  7. int? dpi,
  8. int rotate = 0,
  9. ImageFormat format = ImageFormat.jpeg,
})

Shares an image via Share-dialog.

If quality, size or dpi are given, they will be applied before sharing the image.

Default: JPG.

Sharing on Web

Sharing on Web does not work. Use saveToJpg() instead.

How to get the render box:

if(context.mounted) {
  final RenderBox? box = context.findRenderObject() as RenderBox?;
}

Implementation

static Future<void> shareAs(
  String title,
  String message,
  Uint8List bytes,
  final RenderBox? box, {
  int quality = 100,
  Size? size,
  int? dpi,
  int rotate = 0,
  ImageFormat format = ImageFormat.jpeg,
}) async {
  return ImageSave.shareAs(title, message, bytes, box,
      quality: quality, size: size, dpi: dpi, rotate: rotate, format: format);
}