openIosReview static method

Future<String?> openIosReview({
  1. String? appId,
  2. bool compose = false,
})

Require app review for iOS

Implementation

static Future<String?> openIosReview({
  String? appId,
  bool compose = false,
}) async {
  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')) {
      debugPrint('launching store page');
      await launch('itms-apps://$reviewUrl');
      return 'Launched App Store Directly: $reviewUrl';
    }

    await launch('https://$reviewUrl');
    return 'Launched App Store: $reviewUrl';
  }

  try {
    return _channel.invokeMethod<String>('requestReview');
  } finally {}
}