composeNewEmailInSpecificMailApp static method
Future<bool>
composeNewEmailInSpecificMailApp({
- required MailApp mailApp,
- required EmailContent emailContent,
Allows you to compose a new email in the specified mailApp
witht the
contents from emailContent
MailApp (required) the maill app you wish to launch. Get it by calling getMailApps EmailContent provides content for the email you're composing throws an Exception if you're launching from an unsupported platform.
Implementation
static Future<bool> composeNewEmailInSpecificMailApp({
required MailApp mailApp,
required EmailContent emailContent,
}) async {
if (_isAndroid) {
final result = await _channel.invokeMethod<bool>(
'composeNewEmailInSpecificMailApp',
<String, dynamic>{
'name': mailApp.name,
'emailContent': emailContent.toJson(),
},
) ??
false;
return result;
} else if (_isIOS) {
String? launchScheme = mailApp.composeLaunchScheme(emailContent);
if (launchScheme != null) {
return await launch(
launchScheme,
forceSafariVC: false,
);
}
return false;
} else {
throw Exception('Platform currently not supported');
}
}