Platform<Attributes extends PlatformAttributes> class
Represents a target platform for a build, deployment, or runtime environment.
The Platform class encapsulates both the operating system and platform-specific attributes, allowing type-safe access to OS-specific configuration such as architecture, distribution, API level, or processor.
This class is generic over Attributes, which must extend PlatformAttributes.
This ensures that each platform instance carries the appropriate
metadata for the target operating system.
Constructors
- Platform({required OperatingSystem os, required Attributes attributes})
-
Creates a platform instance with the given
osand platform-specificattributes.const
Properties
- attributes → Attributes
-
Platform-specific attributes, e.g., architecture, distribution, ABI, or processor.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- os → OperatingSystem
-
The operating system of this platform.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
android(
{required AndroidAPI apiLevel, required AndroidABI abi}) → Platform< AndroidAttributes> -
Creates an Android platform with the specified
apiLevelandabi. -
bareMetal(
{required Architecture architecture}) → Platform< BareMetalAttributes> -
Creates a bare-metal platform with the specified CPU
architecture. -
current(
) → Platform< PlatformAttributes> - Returns a representation of the current dart virtual machine platform abi.
-
ios(
{required dynamic sdkVersion}) → Platform< iOSAttributes> -
Creates an iOS platform for the specified
versionandsdkVersion. -
linux(
{required LinuxArchitecture architecture}) → Platform< LinuxAttributes> -
Creates a Linux platform with the specified
architectureand optionaldistribution. Ifdistributionis not provided, defaults toLinuxDistribution.unspecified. -
macos(
{required MacOSProcessor processor, required Version sdkVersion}) → Platform< MacOSAttributes> -
Creates a macOS platform targeting the specified
processor,versionandsdkVersion. -
windows(
{required WindowsArchitecture architecture, required WindowsBuildVersion buildVersion}) → Platform< WindowsAttributes> -
Creates a Windows platform with the specified
architecture.