4

I want Flutter App A to launch Flutter App B passing in arguments.

I want Flutter App B to read these arguments passed by Flutter App A.

How do I do this in Flutter on both iOS & Android?

Raj Chaudhary
  • 1,444
  • 3
  • 16
  • 31

1 Answers1

1

if you know the package name you can do handle it this way add this plugins to your pubspec

 device_apps:
android_intent:
url_launcher:

openAnotherApp (data) async
{String dt = data['hello there'] as String;
  bool isInstalled = await DeviceApps.isAppInstalled('com.another app');
if (isInstalled != false)
 {
    AndroidIntent intent = AndroidIntent(
      action: 'action_view',
      data: dt
  );
  await intent.launch();
 }
else
  {
  String url = dt;
  if (await canLaunch(url)) 
    await launch(url);
   else 
    throw 'Could not launch $url';
}
}

if you want to check app availability first use flutter_appavailability

If already installed then launch otherwise open link in WebView using url_launcher.

griffins
  • 7,079
  • 4
  • 29
  • 54