whatsApp static method
share content to whatsapp
Implementation
static Future<bool> whatsApp(
{String? whatsAppNumber,
String text = "",
OpenMode mode = OpenMode.externalNonBrowserApplication}) async {
if (whatsAppNumber != null && whatsAppNumber.isNotEmpty) {
try {
return await launchUrl(
Uri.parse(
"https://api.whatsapp.com/send?phone=$whatsAppNumber&text=$text"),
mode: _getLaunchMode(mode));
} catch (e) {
return false;
}
} else {
try {
return await launchUrl(Uri.parse("whatsapp://send?text=$text"),
mode: _getLaunchMode(mode));
} catch (e) {
return false;
}
}
}