'Flutter launch business and personal whatsapp programmatically

Sorry to ask this here but couldnt find any information related to this online. In native java I have used intent to select com.whatsapp.w4b and com.whatsapp.

I cant figure out how to do it with dart. So far I know:

String androidUrl = 'https://wa.me/$recipientMobile/?text=${Uri.parse(message)}';
String iosUrl = 'https://api.whatsapp.com/send?phone=$recipientMobile=${Uri.parse(message)}';

if (Platform.isAndroid) {
  await launch(androidUrl);
} else if (Platform.isIOS) {
  if(await canLaunch(iosUrl)){
    await launch(iosUrl);
  } else {
    showToast('Error! Try again.', 'Short');
  }
}

This code works but only launches default WhatsApp. How to launch bussiness / personal whatsapp?

Thanks in advance.



Solution 1:[1]

EITHER you'll have to ask the users to change the defaults in the link settings of the phone as suggested here.

OR you'll have to share a link that they paste in the browser which will open the app selection section of the phone with both the options, as shown here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Advait