getPlatform function

String getPlatform()

Get the platform string for binary downloads (e.g., "darwin-arm64").

Implementation

String getPlatform() {
  String os;
  if (Platform.isMacOS) {
    os = 'darwin';
  } else if (Platform.isWindows) {
    os = 'win32';
  } else {
    os = 'linux';
  }

  // Dart doesn't expose architecture directly; detect from env/uname
  final arch = _detectArch();
  if (arch == null) {
    throw Exception('Unsupported architecture');
  }

  // Check for musl on Linux
  if (os == 'linux' && _isMuslEnvironment()) {
    return '$os-$arch-musl';
  }

  return '$os-$arch';
}