getAll method
Returns a map with the following keys: appName, packageName, version, buildNumber
Implementation
@override
Future<PackageInfoData> getAll({String? baseUrl}) {
String resolvedExecutable = Platform.resolvedExecutable;
/// Workaround for https://github.com/dart-lang/sdk/issues/52309
if (resolvedExecutable.startsWith(r"UNC\")) {
resolvedExecutable = resolvedExecutable.replaceFirst(r"UNC\", r"\\");
}
final info = FileVersionInfo(resolvedExecutable);
final versions = info.productVersion.split('+');
final data = PackageInfoData(
appName: info.productName,
packageName: info.internalName,
version: versions.getOrNull(0) ?? '',
buildNumber: versions.getOrNull(1) ?? '',
buildSignature: '',
);
info.dispose();
return Future.value(data);
}