diff --git a/lib/app_review.dart b/lib/app_review.dart index d9e13dd..a75aab2 100644 --- a/lib/app_review.dart +++ b/lib/app_review.dart @@ -116,14 +116,14 @@ class AppReview { if (compose) { final id = appId ?? (await getIosAppId()) ?? ''; final reviewUrl = 'itunes.apple.com/app/id$id?mt=8&action=write-review'; - - if (await canLaunch('itms-apps://$reviewUrl')) { + final uri = Uri.parse('itms-apps://$reviewUrl'); + if (await canLaunchUrl(uri)) { debugPrint('launching store page'); - await launch('itms-apps://$reviewUrl'); + await launchUrl(uri); return 'Launched App Store Directly: $reviewUrl'; } - await launch('https://$reviewUrl'); + await launchUrl(Uri.parse('https://$reviewUrl')); return 'Launched App Store: $reviewUrl'; } @@ -136,7 +136,7 @@ class AppReview { static Future openAndroidReview() { try { return _channel.invokeMethod('requestReview'); - } on dynamic { + } on Error { return openGooglePlay(); } } @@ -146,12 +146,13 @@ class AppReview { final appId = await getIosAppId() ?? ''; if (appId.isNotEmpty) { - launch('https://itunes.apple.com/app/id$appId'); + launchUrl(Uri.parse('https://itunes.apple.com/app/id$appId'), + mode: LaunchMode.externalApplication); return 'Launched App Store'; } if (fallbackUrl != null) { - launch(fallbackUrl); + launchUrl(Uri.parse(fallbackUrl), mode: LaunchMode.externalApplication); return 'Launched App Store via $fallbackUrl'; } @@ -162,23 +163,24 @@ class AppReview { static Future openGooglePlay({String? fallbackUrl}) async { final bundle = await getBundleName() ?? ''; final markerUrl = 'market://details?id=$bundle'; - - if (await canLaunch(markerUrl)) { + final uri = Uri.parse(markerUrl); + if (await canLaunchUrl(uri)) { debugPrint('launching store page'); - launch(markerUrl); + launchUrl(uri, mode: LaunchMode.externalApplication); return 'Launched Google Play Directly: $bundle'; } if (fallbackUrl != null) { - launch(fallbackUrl); + launchUrl(Uri.parse(fallbackUrl), mode: LaunchMode.externalApplication); return 'Launched Google Play via $fallbackUrl'; } - launch('https://play.google.com/store/apps/details?id=$bundle'); + launchUrl( + Uri.parse('https://play.google.com/store/apps/details?id=$bundle')); return 'Launched Google Play: $bundle'; } - /// Lazyload package info instance + /// Lazy load package info instance static Future getPackageInfo() async { _packageInfo ??= await PackageInfo.fromPlatform(); diff --git a/pubspec.yaml b/pubspec.yaml index d606772..48fc3a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,13 +6,13 @@ homepage: https://github.com/rodydavis/plugins repository: https://github.com/fluttercommunity/app_review environment: - sdk: '>=2.12.0-259.8.beta <3.0.0' + sdk: ">=2.16.0 <3.0.0" flutter: ^1.10.0 dependencies: - http: ^0.13.0-nullsafety.0 - package_info_plus: ^1.0.0 - url_launcher: ^6.0.0-nullsafety.6 + http: ^0.13.5 + package_info_plus: ^3.0.1 + url_launcher: ^6.1.6 flutter: sdk: flutter