soil_logr
soil_logr copied to clipboard
Check if iOS has access to a mailing app
trafficstars
final bool canSend = await FlutterMailer.canSendMail();
if(!canSend && Platform.isIOS) {
final url = 'mailto:?body=$body&subject=$subject';
if (await canLaunch(url)) {
await launch(url);
} else {
print("FlutterMailer");
createAlertDialog(BuildContext context) {
return showDialog(context: context, builder: (context) {
return AlertDialog(
title: Text('Delete all samples'),
content: Text('Are you sure you want to delete?'),
actions: [
MaterialButton(
child: Text('Ok'),
onPressed: () {
// Navigator.of(context).pop(SampleList());
},
),
],
);
});
}
throw 'Could not launch $url';
}
}
Something like this but this is not perfect. May need to pass the context to the mailer functions of pass back a response.