需要在 pubspec.yaml 中导入这个库:package_info
使用时import 'package:package_info/package_info.dart';
void _getVersion() async {
PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
setState(() {
_version = packageInfo.version;
});
});
}
网友评论