share method Null safety
Shares the selected wallpaperModel at pixelRatio
with the provided subject
and text
Implementation
Future<void> share(
{String subject = '', String? text, double? pixelRatio}) async {
final tempDir = await getTemporaryDirectory();
Uint8List? imageFile =
await screenshotController.capture(pixelRatio: pixelRatio);
if (imageFile != null) {
var path = '${tempDir.path}/share.jpg';
final file = await File(path).create();
file.writeAsBytesSync(imageFile);
Share.shareFiles([path], text: text, subject: subject);
}
}