sendEmail static method
Opens the email app to send an email to the given email
with an optional subject
and body
.
Implementation
static Future sendEmail({
required String email,
String subject = "",
String body = "",
}) async {
try {
final mail = Uri(
scheme: "mailto",
path: email,
query: _encodeQueryParameters(<String, String>{
"subject": subject,
"body": body,
}),
);
await launchUrl(mail);
} catch (error, stackTrace) {
ErrorLogger.instance.logError(
error: error,
stackTrace: stackTrace,
file: "url_launcher_helper",
event: "sendEmail",
);
return Future.error(error);
}
}