App更新提醒插件
让您的应用用户及时了解其设备上的最新版本
借助此 Flutter 插件。
- 检查用户是否安装了最新版本的您的应用程序。
- 向用户显示一条消息,其中包含指向相关应用商店页面的链接。
在 Dart Packages 页面 上查看更多内容。
安装
将 app_update_alert 添加到您 pubspec.yaml 文件的 依赖项中。
使用 Flutter
Run this command:
flutter pub add app_update_alert
这将在您的软件包的 pubspec.yaml 中添加类似下面的行
dependencies:
app_update_alert: ^1.5.0
运行隐式的 flutter pub get
用法
在 main.dart (或初始化应用的其他任何位置) 中创建 AppUpdate 实例。
@override
void initState() {
super.initState();
final appUpdate = AppUpdate(
iosPackageName: 'com.your.IOSpackage',
androidPackageName: 'com.your.Androidpackage',
iOSAppStoreCountry: 'in'
);
}
该插件将自动使用您的 Flutter软件包标识来搜索应用商店。如果您的应用在 Google Play 商店或 Apple App 商店中使用不同的标识,则可以通过提供 androidPackageName 和/或 iosPackageName 的值来覆盖此标识。
对于 iOS: 如果您的应用仅在印度以外地区可用,则必须将 iOSAppStoreCountry 指定为要搜索的软件商店的两字母国家代码。有关 ISO 国家代码列表,请访问 http://en.wikipedia.org/wiki/ISO 3166-1 alpha-2。
快速入门
通过调用带有您的应用的 BuildContext 的 showUpdateAlert 将检查应用是否可以更新,并自动显示一个平台特定的警报,用户可以使用该警报前往应用商店。
@override
void initState() {
super.initState();
final appUpdate = AppUpdate(
iosPackageName: 'com.your.IOSpackage',
androidPackageName: 'com.your.Androidpackage',
iOSAppStoreCountry: 'in'
);
appUpdate.showUpdateAlert(context: context);
}
平台支持
ANDROID - ✅ Yes
IOS - ✅ Yes
LINUX - ❌ No
MACOS - ❌ No
WEB - ❌ No
WINDOWS - ❌ No
许可证
Copyright [2022] [Vinod Baste]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
