I am using url_launcher plugin in Flutter to Share Email with Subject and its working fine in Android with this package, but nothing happens with Ios or Iphone.
I have crated below function for the same:
void _launchEmail() async {
String email = Uri.encodeComponent("");
String productTitle =
_catalogStore.summaryInfo?.data?[widget.productIndex].title ?? "";
String productId =
_catalogStore.summaryInfo?.data?[widget.productIndex].id ?? "";
String subject = Uri.encodeComponent(
"mpo_product".tr() + " - " + productTitle + "($productId)");
String body = Uri.encodeComponent("");
Uri mail = Uri.parse("mailto:$email?subject=$subject&body=$body");
try {
await launchUrl(mail);
} catch (e) {
ToastUtil.show(
ToastDecorator(
isSuccess: false,
msg: "something_went_wrong".tr() + "\n" + e.toString()),
context,
gravity: ToastGravity.bottom);
}
}
What might be the issue?
It was not working in Simulator, Checked in real Ios Device and it worked!