dart:io Platform class   Information about the environment in which the current program is running. Platform provides information such as the operating system, the hostname of the computer, the value of environment variables, the path to the running program, and other global properties of the program being run. Get the URI of the current Dart script Use the script getter to get the URI to the currently running Dart script. import 'dart:io' show Platform;

void main() {
  // Get the URI of the script being run.
  var uri = Platform.script;
  // Convert the URI to a path.
  var path = uri.toFilePath();
} Get the value of an environment variable The environment getter returns a the names and values of environment variables in a Map that contains key-value pairs of strings. The Map is unmodifiable. This sample shows how to get the value of the PATH environment variable. import 'dart:io' show Platform;

void main() {
  Map<String, String> envVars = Platform.environment;
  print(envVars['PATH']);
} Determine the OS You can get the name of the operating system as a string with the operatingSystem getter. You can also use one of the static boolean getters: isMacOS, isLinux, isWindows, etc. import 'dart:io' show Platform;

void main() {
  // Get the operating system as a string.
  String os = Platform.operatingSystem;
  // Or, use a predicate getter.
  if (Platform.isMacOS) {
    print('is a Mac');
  } else {
    print('is not a Mac');
  }
} Constructors   Platform()   Properties   hashCode → int read-only, inherited
  The hash code for this object.    runtimeType → Type read-only, inherited
  A representation of the runtime type of the object.    Methods   noSuchMethod(Invocation invocation) → dynamic  inherited
  Invoked when a non-existent method or property is accessed.    toString() → String inherited
  A string representation of this object.    Operators   operator ==(Object other) → bool inherited
  The equality operator.    Static Properties   environment → Map<String, String> read-only
  The environment for this process as a map from string key to string value.    executable → String read-only
  The path of the executable used to run the script in this isolate. Usually dart when running on the Dart VM or the compiled script name (script_name.exe).    executableArguments → List<String> read-only
  The flags passed to the executable used to run the script in this isolate.    isAndroid → bool final
  Whether the operating system is a version of Android.    isFuchsia → bool final
  Whether the operating system is a version of Fuchsia.    isIOS → bool final
  Whether the operating system is a version of iOS.    isLinux → bool final
  Whether the operating system is a version of Linux.    isMacOS → bool final
  Whether the operating system is a version of macOS.    isWindows → bool final
  Whether the operating system is a version of Microsoft Windows.    localeName → String read-only
  Get the name of the current locale.    localHostname → String read-only
  The local hostname for the system.    numberOfProcessors → int read-only
  The number of individual execution units of the machine.    operatingSystem → String read-only
  A string representing the operating system or platform.    operatingSystemVersion → String read-only
  A string representing the version of the operating system or platform.    packageConfig → String? read-only
  The --packages flag passed to the executable used to run the script in this isolate.    pathSeparator → String read-only
  The path separator used by the operating system to separate components in file paths.    resolvedExecutable → String read-only
  The path of the executable used to run the script in this isolate after it has been resolved by the OS.    script → Uri read-only
  The absolute URI of the script being run in this isolate.    version → String read-only
  The version of the current Dart runtime.   

    
{'path': 'public/docs/dart~2/dart-io/platform-class.html', 'source': 'DevDocs.IO'}