launchApp static method

Future<void> launchApp({
  1. String androidPackage = "",
  2. String iosUrlScheme = "",
  3. bool? launchStore = false,
  4. String playStoreUrl = "",
  5. String appStoreUrl = "",
  6. Map<String, dynamic> params = const {},
})

method that launches open another application by using platform specific api's
androidPackage android appId, to get appId from playstore check playstore query param ?id=com.xyz
iosUrlScheme iOS url scheme, to get url scheme check appilication docs.for example for whatsapp url scheme is whatsapp://
launchStore passed true then, it will launch application store from provided link if not installed on device
playStoreUrl appstore url for andorid
appStoreUrl appstore url for iOS

Implementation

static Future<void> launchApp(
    {String androidPackage = "",
    String iosUrlScheme = "",
    bool? launchStore = false,
    String playStoreUrl = "",
    String appStoreUrl = "",
    Map<String,dynamic> params = const {}
    }) async {
  String identifier = Platform.isAndroid ? androidPackage : iosUrlScheme;
  String storeUrl = Platform.isAndroid ? playStoreUrl : appStoreUrl;
  await _channel.invokeMethod(LAUNCH_APP, {
    "appIdentifier": identifier,
    "storeUrl": storeUrl,
    "launchStore": launchStore,
    "data": params
  });
}