openWhatsapp method
Implementation
void openWhatsapp(BuildContext context, String number) async {
var numberWithcode = "91$number";
var whatsappURlAndroid = "whatsapp://send?phone=$numberWithcode&text=hello";
var whatappURLIos =
"https://wa.me/$numberWithcode?text=${Uri.parse("hello")}";
if (Platform.isIOS) {
if (await canLaunch(whatappURLIos)) {
await launch(whatappURLIos, forceSafariVC: false);
} else {
showSnackBar(
"Whatsapp not installed", context, AppColors.appColorBackground);
}
} else {
if (await canLaunch(whatsappURlAndroid)) {
await launch(whatsappURlAndroid);
} else {
showSnackBar("Whatsapp not installed$numberWithcode", context,
AppColors.appColorBackground);
}
}
}