1、
flutter 官方 sky_engine 库
'version': Platform.version,
下面是注释:
2.5.3/bin/cache/pkg/sky_engine/lib/io/platform.dart
/// The version of the current Dart runtime.
///
/// The value is a [semantic versioning](http://semver.org)
/// string representing the version of the current Dart runtime,
/// possibly followed by whitespace and other version and
/// build details.
static String get version => _version;
这是啥?
2、
package_info_plus: ^1.4.2 插件:
dart获取
PackageInfo packageInfo = await PackageInfo.fromPlatform();
platformHeader['version'] = packageInfo.version;
PackageInfo dart测API 的注释 :
/// The package version. `CFBundleShortVersionString` on iOS, `versionName` on Android.
final String version;
PackageInfo 插件NATIVE 实现:
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([call.method isEqualToString:@"getAll"]) {
result(@{
@"appName" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
?: [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"] ?: [NSNull null],
@"packageName" : [[NSBundle mainBundle] bundleIdentifier] ?: [NSNull null],
@"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
?: [NSNull null],
@"buildNumber" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
?: [NSNull null],
});
} else {
result(FlutterMethodNotImplemented);
}
}
这样就清楚了