agentSdkPlatformFor function

String? agentSdkPlatformFor({
  1. required String operatingSystem,
  2. required bool isArm64,
})

The Agent SDK's name for a host's platform package suffix — darwin-arm64, linux-x64, win32-x64 — or null for a host it ships no CLI for.

The names are the SDK's (Node's process.platform-process.arch), not Dart's, so this is a translation rather than a formatting. It answers for the Dart process; the installer asks the Node it will run instead (see chooseAgentSdkPlatform), because on Windows on ARM an x64 Flutter build under emulation and an arm64 Node are an ordinary combination.

Implementation

String? agentSdkPlatformFor({
  required String operatingSystem,
  required bool isArm64,
}) {
  final arch = isArm64 ? 'arm64' : 'x64';
  return switch (operatingSystem) {
    'macos' => 'darwin-$arch',
    'linux' => 'linux-$arch',
    'windows' => 'win32-$arch',
    _ => null,
  };
}