openAppStore method
Future<bool>
openAppStore({
- String? packageName,
- String? marketPackageName,
- bool androidUseIntent = true,
- String? appId,
- LaunchMode mode = LaunchMode.platformDefault,
- WebViewConfiguration webViewConfiguration = const WebViewConfiguration(),
- String? webOnlyWindowName,
Implementation
Future<bool> openAppStore({
/// android use
String? packageName,
/// 指定打开应用商店的报名
String? marketPackageName,
/// android use intent launch
bool androidUseIntent = true,
/// ios macos use
String? appId,
LaunchMode mode = LaunchMode.platformDefault,
WebViewConfiguration webViewConfiguration = const WebViewConfiguration(),
String? webOnlyWindowName,
}) async {
if ((isIOS || isMacOS) && appId.isNotEmptyOrNull) {
final String url = 'itms-apps://itunes.apple.com/us/app/$appId';
return await openUrl(url,
mode: mode,
webOnlyWindowName: webOnlyWindowName,
webViewConfiguration: webViewConfiguration);
} else if (isAndroid && packageName.isNotEmptyOrNull) {
final String url = 'market://details?id=$packageName';
if (androidUseIntent) {
await AndroidAppMarketIntent(
packageName: packageName!, package: marketPackageName)
.launch();
return true;
} else {
return await openUrl(url,
mode: mode,
webOnlyWindowName: webOnlyWindowName,
webViewConfiguration: webViewConfiguration);
}
}
return false;
}