android – Flutter Share Email not working on Ios with url_launcher package


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?

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img