saveAndShare method Null safety

Future saveAndShare(
  1. Uint8List bytes
)

Saves and shares the image.

Returns a Future.

Implementation

static Future saveAndShare(Uint8List bytes) async {
  final directory = await getApplicationDocumentsDirectory();
  final image = File('${directory.path}/flutter.png');
  image.writeAsBytesSync(bytes);
  XFile f = XFile(image.path);
  await Share.shareXFiles([f]);
}