FakePlatform class final

A mutable implementation of the legacy Platform interface.

Warning

Use package:platform/testing.dart for testing the non-deprecated API, and use TestNativePlatform to give custom values to native platform properties.

Implemented types
Available extensions
Annotations

Constructors

FakePlatform({int? numberOfProcessors, String? pathSeparator, String? operatingSystem, String? operatingSystemVersion, String? localHostname, Map<String, String>? environment, String? executable, String? resolvedExecutable, Uri? script, List<String>? executableArguments, String? packageConfig, String? version, bool? stdinSupportsAnsi, bool? stdoutSupportsAnsi, String? localeName})
Creates a new legacy FakePlatform with the specified properties.
FakePlatform.fromJson(String json)
Creates a new FakePlatform with properties extracted from the encoded JSON string.
factory
FakePlatform.fromPlatform(Platform platform)
Creates a new FakePlatform with properties values mirroring platform.

Properties

browserPlatform → BrowserPlatform?
The current browser platform, if running on a browser platform.
no setteroverride
environment → Map<String, String>
The environment for this process.
no setter
executable → String
The file path of the executable used to run the script in this isolate.
no setter
executableArguments → List<String>
The flags passed to the executable used to run the script of this program.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isAlma → bool

Available on Platform, provided by the PlatformLinuxDistro extension

AlmaLinux
no setter
isAndroid → bool
Whether a Platform.nativePlatform with NativePlatform.isAndroid.
no setterinherited
isAndroid → bool

Available on Platform, provided by the PlatformIsOS extension

Whether this is a nativePlatform with NativePlatform.isAndroid.
no setter
isArch → bool

Available on Platform, provided by the PlatformLinuxDistro extension

Arch Linux
no setter
isBrowser → bool
Whether currently running in a browser.
no setteroverride
isBudgie → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

Budgie
no setter
isCinnamon → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

Cinnamon
no setter
isDebian → bool

Available on Platform, provided by the PlatformLinuxDistro extension

Debian
no setter
isDeepin → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

Deepin
no setter
isEnlightenment → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

Enlightenment
no setter
isFedora → bool

Available on Platform, provided by the PlatformLinuxDistro extension

Fedora
no setter
isFuchsia → bool
Whether a Platform.nativePlatform with NativePlatform.isFuchsia.
no setterinherited
isFuchsia → bool

Available on Platform, provided by the PlatformIsOS extension

Whether this is a nativePlatform with NativePlatform.isFuchsia.
no setter
isGNOME → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

GNOME
no setter
isIOS → bool
Whether a Platform.nativePlatform with NativePlatform.isIOS.
no setterinherited
isIOS → bool

Available on Platform, provided by the PlatformIsOS extension

Whether this is a nativePlatform with NativePlatform.isIOS.
no setter
isKDE → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

KDE
no setter
isLinux → bool
Whether a Platform.nativePlatform with NativePlatform.isLinux.
no setterinherited
isLinux → bool

Available on Platform, provided by the PlatformIsOS extension

Whether this is a nativePlatform with NativePlatform.isLinux.
no setter
isLXQt → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

LXQt
no setter
isMacOS → bool
Whether a Platform.nativePlatform with NativePlatform.isMacOS.
no setterinherited
isMacOS → bool

Available on Platform, provided by the PlatformIsOS extension

Whether this is a nativePlatform with NativePlatform.isMacOS.
no setter
isManjaro → bool

Available on Platform, provided by the PlatformLinuxDistro extension

Manjaro
no setter
isMATE → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

MATE
no setter
isNative → bool
Whether currently running on a native platform.
no setteroverride
isOpenSUSE → bool

Available on Platform, provided by the PlatformLinuxDistro extension

openSUSE
no setter
isPantheon → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

Pantheon
no setter
isPopOS → bool

Available on Platform, provided by the PlatformLinuxDistro extension

Pop!_OS
no setter
isUbuntu → bool

Available on Platform, provided by the PlatformLinuxDistro extension

Ubuntu
no setter
isUKUI → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

UKUI
no setter
isUnity → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

Unity
no setter
isWindows → bool

Available on Platform, provided by the PlatformIsOS extension

Whether this is a nativePlatform with NativePlatform.isWindows.
no setter
isWindows → bool
Whether a Platform.nativePlatform with NativePlatform.isWindows.
no setterinherited
isXfce → bool

Available on Platform, provided by the PlatformLinuxDesktop extension

Xfce
no setter
localeName → String
Get the name of the current locale.
no setter
localHostname → String
Get the local hostname for the system.
no setter
nativePlatform → NativePlatform
The current native platform, if running on a native platform.
no setteroverride
numberOfProcessors → int
The number of processors of the machine.
no setter
operatingSystem → String
A string representing the operating system.
no setter
operatingSystemVersion → String
A string representing the version of the operating system or platform.
no setter
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.
no setter
pathSeparator → String
The path separator used by the operating system to separate components in file paths.
no setter
resolvedExecutable → String
The path of the executable used to run the script in this isolate after it has been resolved by the OS.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
script → Uri
The absolute URI of the script being run in this isolate.
no setter
stdinSupportsAnsi → bool
When stdin is connected to a terminal, whether ANSI codes are supported.
no setter
stdoutSupportsAnsi → bool
When stdout is connected to a terminal, whether ANSI codes are supported.
no setter
version → String
The version of the current Dart runtime.
no setter

Methods

copyWith({int? numberOfProcessors, String? pathSeparator, String? operatingSystem, String? operatingSystemVersion, String? localHostname, Map<String, String>? environment, String? executable, String? resolvedExecutable, Uri? script, List<String>? executableArguments, String? packageConfig, String? version, bool? stdinSupportsAnsi, bool? stdoutSupportsAnsi, String? localeName}) → FakePlatform
Creates a new FakePlatform from this one, with some properties replaced by the given properties.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → String
A JSON-encoded representation of platform information.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited