shareOptions static method
Implementation
static Future<bool?> shareOptions(String contentText,
{String? imagePath}) async {
Map<String, dynamic> args;
if (Platform.isIOS) {
args = <String, dynamic>{"image": imagePath, "content": contentText};
} else {
if (imagePath != null) {
File file = File(imagePath);
Uint8List bytes = file.readAsBytesSync();
var imagedata = bytes.buffer.asUint8List();
final tempDir = await getTemporaryDirectory();
String imageName = 'stickerAsset.png';
final Uint8List imageAsList = imagedata;
final imageDataPath = '${tempDir.path}/$imageName';
file = await File(imageDataPath).create();
file.writeAsBytesSync(imageAsList);
args = <String, dynamic>{"image": imageName, "content": contentText};
} else {
args = <String, dynamic>{"image": imagePath, "content": contentText};
}
}
final bool? version = await _channel.invokeMethod('shareOptions', args);
return version;
}