This example demonstrates the use of app manifests in Windows.
By default, Windows emphasizes maximum backwards compatibility, even to the
point of modeling older behavior on newer systems. For example, if you call the
GetVersionEx() function to ask Windows what version it is, it will return the
same version information, regardless of whether you are running Windows 8,
Windows 8.1, or Windows 10.
You can tell Windows that your app is aware of later versions with an app manifest, which opts your app into new behavior.
You can see this behavior in action by running version.dart (which calls
GetVersionEx()) in a few different configurations. The documented behavior
below assumes that you are running Windows 10.
Note that Windows 11 reports itself as 10.0.22000.0, so these APIs cannot be
used to differentiate between Windows 10 and Windows 11. For that, you should
check the build number. An example of that can be found in sysinfo.dart.
dart version.dartIn this scenario, the Dart command-line utility is called to run the Dart file.
Since no app manifest exists, this command returns Windows 6.2 (which
is the version number reported by Windows 8).
Run this command to compile version.dart:
dart compile exe -o version.exe version.dartSupplied in this folder is version.exe.manifest, which is an app compat
manifest that expressly identifies that this app is designed for Windows 10.
Now, you should see the same app code respond with Windows 10.0.
If you copy or rename the executable to something else and run it again:
copy version.exe version2.exe
version2.exeYou'll see that the same executable, in the absence of a matching app manifest,
reports Windows 6.2 as before.