sendUserToAppStore method

void sendUserToAppStore()

Launch the app store from the app store listing URL.

Implementation

void sendUserToAppStore() async {
  final appStoreListingURL = versionInfo?.appStoreListingURL;
  if (appStoreListingURL == null || appStoreListingURL.isEmpty) {
    if (state.debugLogging) {
      print('upgrader: empty appStoreListingURL');
    }
    return;
  }

  if (state.debugLogging) {
    print('upgrader: launching: $appStoreListingURL');
  }

  if (await canLaunchUrl(Uri.parse(appStoreListingURL))) {
    try {
      await launchUrl(Uri.parse(appStoreListingURL),
          mode: state.upgraderOS.isAndroid
              ? LaunchMode.externalNonBrowserApplication
              : LaunchMode.platformDefault);
    } catch (e) {
      if (state.debugLogging) {
        print('upgrader: launch to app store failed: $e');
      }
    }
  }
}