I have used Url_launcher package;I want to open Facebook link in facebook app if app installed else the browser.This nicely works in Android but in IOS it only open the Facebook app not the link.
The code is :
String digital_url= "https://facebook.com/AliForDigitalIsrael/";
new ListTile(
leading: new SvgPicture.asset(
'assets/images/ic_menu_fb.svg',
height: 24.0,
width: 24.0,
color: Colors.black54,
),
title: new Text(
Strings.fbdigital,
textDirection: TextDirection.rtl,
),
onTap: () async {
var fbUrl =
"fb://facewebmodal/f?href=" + Strings.digital_url;
launchFacebook(fbUrl, Strings.digital_url);
hideDrawer();
},
),
Future<void> launchFacebook(String fbUrl,String fbWebUrl)
async {
try {
bool launched = await launch(fbUrl, forceSafariVC: false);
print("Launched Native app $launched");
if (!launched) {
await launch(fbWebUrl, forceSafariVC: false);
print("Launched browser $launched");
}
} catch (e) {
await launch(fbWebUrl, forceSafariVC: false);
print("Inside catch");
}
}