os_detect 2.0.1 os_detect: ^2.0.1 copied to clipboard
Platform independent OS detection.
Platform independent access to information about the current operating system.
Querying the current OS #
similar to those of the
Platform class in
but also works on the web.
operatingSystem of a browser is the string "browser".
Also exposes convenience getters like
based on the
To use this package instead of
the import of
import "package:os_detect/os_detect.dart" as Platform;
That should keep the code working if the only functionality used from
is operating system detection.
You should then use your IDE to rename the import prefix from
to something lower-cased which follows the style guide for import prefixes.
Any new platform which supports neither
can make itself recognizable by configuring
dart.os.version environment settings,
const String.fromEnvironment can access them.
Overriding the current OS string #
It's possible to override the current operating system string,
as exposed by
To do so, import the
and use the
overrideOperatingSystem function to run code in a zone
where the operating system and version values are set
to whatever values are desired.
OperatingSystemID can also be used directly to
abstract over the operating system name and version.
OperatingSystemID.current defaults to the values provided by the platform
when not overridden using