shareContent function
void shareContent(
- BuildContext context,
- {dynamic title,
- dynamic message,
- dynamic url}
)
Implementation
void shareContent(BuildContext context, {title, message, url}) {
if (kIsWeb) {
bool handled =
web.context.callMethod("shareContent", [title, message, url]);
if (!handled) {
showDialog(
context: context,
builder: (context) {
return Dialog(
child: WebShareDialog(
entity: ShareEntity(url: url, title: title, summary: message),
),
);
});
}
} else {
if (Platform.isIOS) {
try {
final Map<String, dynamic> args = <String, dynamic>{
'subject': title,
'message': message,
'url': url
};
platform.invokeMethod('shareContent', args);
} on PlatformException catch (e) {
if (kDebugMode) {
print(e);
}
}
} else {
Share.share(message, subject: title);
}
}
LogApi().logEvent(LogEvent(name: "share", value: url));
}