Flutter url_launcher Attach file and email file

1,308 views
Skip to first unread message

flutter testing

unread,
Mar 4, 2020, 5:03:49 AM3/4/20
to Flutter Development (flutter-dev)
Requirement: I have to send file in the email. 
Problem: When user taps on the send icon, it calls launchURL method which opens up mail client without any issue. 
But if I add file to url variable, it does not attach the file.
launchURL method is given below. I will appreciate any help.


import 'package:url_launcher/url_launcher.dart';

  launchURL(toMailId, subject, body, file ) async {

var url = 'mailto:$toMailId?subject=$subject&body=$body'; // This works fine

// var url = 'mailto:$toMailId?subject=$subject&body=$body&file=$file'; // This does not attach the file

if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}


Reply all
Reply to author
Forward
0 new messages