launchStoreListing method
Launches the URL for reviewing.
- Android: If play store installed, opens play store via
market:
url, otherwise launcheshttps://play.google.com/
- iOS: Open
itunes.apple.com
- setiosWriteReview
to true to use?action=write-review
Implementation
Future<bool> launchStoreListing({bool iosWriteReview = true}) async {
if (Platform.isIOS) {
final appId = await getIosAppId();
// https://developer.apple.com/documentation/storekit/skstorereviewcontroller/requesting_app_store_reviews?language=objc
final urlPostfix = iosWriteReview ? '?action=write-review' : '';
return await urlLaunch('${getIosStoreListing(appId)}$urlPostfix');
} else {
final appId = await _getPackageName();
if (await urlCanLaunch('market://')) {
return await urlLaunch('market://details?id=$appId');
} else {
return await urlLaunch(getAndroidStoreListing(appId));
}
}
}