With current fix for onShare when it is on iPad, we were using RenderBox to send sharePositionOrigin, but in some cases (maybe when it is on android), this returns null and throws CastError exception. link
So i have added null check before actually using it, (not sure we should add double check like platform - maybe redundant)
From
final RenderBox box = context.findRenderObject() as RenderBox;
final outputFile = await imageTranscodeBloc.transcodeImageToJpg(task);
await Share.shareXFiles(
[XFile(outputFile.path)],
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size,
);
To
final RenderBox? box = context.findRenderObject() as RenderBox?;
final outputFile = await imageTranscodeBloc.transcodeImageToJpg(task);
if (box == null) {
await Share.shareXFiles([XFile(outputFile.path)]);
} else {
await Share.shareXFiles(
[XFile(outputFile.path)],
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size,
);
}
Overview
With current fix for onShare when it is on iPad, we were using RenderBox to send sharePositionOrigin, but in some cases (maybe when it is on android), this returns null and throws CastError exception. link
So i have added null check before actually using it, (not sure we should add double check like platform - maybe redundant)
From
To