openPlatformApp method

Future<void> openPlatformApp({
  1. Object? androidAppId,
  2. Object? iosAppId,
})

Opens a platform-specific app.

On Android, opens the app specified by androidAppId (package name). On iOS, opens the app specified by iosAppId (bundle identifier).

Implementation

Future<void> openPlatformApp({Object? androidAppId, Object? iosAppId}) {
  return platform.action.mobile(
    android: () {
      if (androidAppId == null) {
        throw ArgumentError(
          'androidAppId cannot be null when calling openPlatformApp action on Android',
        );
      }
      return platform.android.openPlatformApp(androidAppId: androidAppId);
    },
    ios: () {
      if (iosAppId == null) {
        throw ArgumentError(
          'iosAppId cannot be null when calling openPlatformApp action on IOS',
        );
      }
      return platform.ios.openPlatformApp(iosAppId: iosAppId);
    },
  );
}