im trying to link whatsapp with this function, i already try many url options but nothing works
static Future launchThisUrl(url) async {
Uri dataUrl = Uri.parse(url!);
if (await canLaunchUrl(dataUrl)) {
await launchUrl(dataUrl);
} else {
throw 'Could not launch $dataUrl';
}
}
static launchWhatsApp(
{required String phone, required String message}) async {
String url = '';
if (Platform.isAndroid) {
url = "https://wa.me/$phone?text=${Uri.parse(message)}";
log('ANDROID == $url');
} else {
log('IOS');
url = "https://wa.me/send?phone=$phone&text=${Uri.parse(message)}";
}
await launchThisUrl(url);
}
but it always return this
2
Answers
The url in my case that works, looks like this. Try this:
Maybe this can help you: