isArm function

bool isArm()

Returns true when the current CPU architecture is ARM (64-bit).

Runs uname -m and checks whether the machine type string equals arm64 or aarch64. This is used by DockerContainer.maybeEmulateAmd64 to automatically add the platform: linux/amd64 option when running on Apple Silicon or other ARM64 hosts.

Returns false if uname is not available or any error occurs.

Implementation

bool isArm() {
  try {
    final result = Process.runSync('uname', ['-m']);
    final machine = result.stdout.toString().trim().toLowerCase();
    return machine == 'arm64' || machine == 'aarch64';
  } catch (_) {
    return false;
  }
}