launchEmail function

dynamic launchEmail({
  1. required String recipient,
  2. required String subject,
  3. required String body,
})

Implementation

launchEmail({
  required String recipient,
  required String subject,
  required String body,
}) async {
  Uri url = Uri(
    scheme: 'mailto',
    path: recipient,
    query: 'subject=$subject&body=$body',
  );

  if (await canLaunchUrl(url)) {
    await launchUrl(url);
  } else {
    print('Could not launch');
  }
}