Using url_launcher I can open phone to call a number.
var phone = "+123456789";
launch("tel://$phone");
How can I do the same for facebook messenger and whatsapp?
I found the solution.
To open whatsapp:
var whatsappUrl ="whatsapp://send?phone=$phone";
await canLaunch(whatsappUrl)? launch(whatsappUrl):print("open whatsapp app link or do a snackbar with notification that there is no whatsapp installed");
To open messenger or facebook:
First get shortened url
If your facebook profile is facebook.com/yourName
facebook url would be fb.me/yourName
and messenger url would be m.me/yourName
then you do
launch("http://$messengerUrl");
Facebook website will automatically open the link in the app even though it goes trough URL browser. If there is no app installed, it will go to the app/play store