Platform class Null safety
Provides API parity with the Platform
class in dart:io
, but using
instance properties rather than static properties. This difference enables
the use of these APIs in tests, where you can provide mock implementations.
- Implementers
Constructors
Properties
-
environment
→ Map<
String, String> -
The environment for this process.
read-only
- executable → String
-
The path of the executable used to run the script in this isolate.
read-only
-
executableArguments
→ List<
String> -
The flags passed to the executable used to run the script in this
isolate. These are the command-line flags between the executable name
and the script name. Each fetch of
executableArguments
returns a new list containing the flags passed to the executable.read-only - hashCode → int
-
The hash code for this object.
read-onlyinherited
- isAndroid → bool
-
True if the operating system is Android.
read-only
- isFuchsia → bool
-
True if the operating system is Fuchsia
read-only
- isIOS → bool
-
True if the operating system is iOS.
read-only
- isLinux → bool
-
True if the operating system is Linux.
read-only
- isMacOS → bool
-
True if the operating system is OS X.
read-only
- isWindows → bool
-
True if the operating system is Windows.
read-only
- localeName → String
-
Get the name of the current locale.
read-only
- localHostname → String
-
Get the local hostname for the system.
read-only
- numberOfProcessors → int
-
The number of processors of the machine.
read-only
- operatingSystem → String
-
A string (
linux
,macos
,windows
,android
,ios
, orfuchsia
) representing the operating system.read-only - operatingSystemVersion → String
-
A string representing the version of the operating system or platform.
read-only
- packageConfig → String?
-
The value of the
--packages
flag passed to the executable used to run the script in this isolate. This is the configuration which specifies how Dart packages are looked up.read-only - pathSeparator → String
-
The path separator used by the operating system to separate
components in file paths.
read-only
- resolvedExecutable → String
-
The path of the executable used to run the script in this
isolate after it has been resolved by the OS.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- script → Uri
-
The absolute URI of the script being run in this
isolate.
read-only
- stdinSupportsAnsi → bool
-
When stdin is connected to a terminal, whether ANSI codes are supported.
read-only
- stdoutSupportsAnsi → bool
-
When stdout is connected to a terminal, whether ANSI codes are supported.
read-only
- version → String
-
The version of the current Dart runtime.
read-only
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toJson(
) → String - Returns a JSON-encoded representation of this platform.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- android → const String
-
A string constant to compare with operatingSystem to see if the platform
is Android.
'android'
- fuchsia → const String
-
A string constant to compare with operatingSystem to see if the platform
is Fuchsia.
'fuchsia'
- iOS → const String
-
A string constant to compare with operatingSystem to see if the platform
is iOS.
'ios'
- linux → const String
-
A string constant to compare with operatingSystem to see if the platform
is Linux.
'linux'
- macOS → const String
-
A string constant to compare with operatingSystem to see if the platform
is macOS.
'macos'
-
operatingSystemValues
→ const List<
String> -
A list of the possible values that operatingSystem can return.
<String>[linux, macOS, windows, android, iOS, fuchsia]
- windows → const String
-
A string constant to compare with operatingSystem to see if the platform
is Windows.
'windows'