我尝试从PackageInfo获取应用程序的版本,但值为空。救命啊!
PackageInfo packageInfo =
await PackageInfo.fromPlatform();
print('package info: $packageInfo');
我尝试在终端打印PackageInfo:
PackageInfo(appName: MyApp, buildNumber: 3, version: )
正如你所看到的是从响应空的版本...我也试过:
Future getVersion() async {
PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
setState(() {
appName = packageInfo.appName;
version = packageInfo.version;
print('version: $version');
});
});
}
1条答案
按热度按时间093gszye1#