Skip to content

dartc 0.5.0

Latest

Choose a tag to compare

@medz medz released this 30 Oct 17:17
· 536 commits to main since this release

dartc 0.5.0 adds generic classes, automatic memory reclamation, Intel Mac support, and native-library exports with generated C/C++ headers. Native compiler downloads now contain a self-contained executable.

This remains an early preview. Complete Dart language and standard-library compatibility is the goal; current behavior and gaps are recorded in the 0.5 specification tracker.

Upgrading from 0.4: replace the previous native installation with the 0.5.0 archive. Its bin/dartc can be copied anywhere on PATH, without an adjacent lib/ directory. Native-library exports now use @Export<T> instead of --export or Pointer.fromFunction. The Dart package requires SDK ^3.13.7.

🧩 Generic Dart classes

Generic instances and const objects retain their type arguments, with constructor inference, runtime type checks and generic object patterns:

class Box<T>(final T value);

void main() {
  final box = Box(42);
  print(box.value);
}

This release also adds class modifiers, sealed-class exhaustiveness checks, covariant members, abstract instance fields and broader field/callback inference. See the changelog for the full list.

📦 Standalone native compilers

Extract the archive for your platform and add its bin directory to PATH. The compiler includes its required library sources, so it can be moved as a single executable. Generated programs also run without an installed Dart SDK.

Managed objects can now be reclaimed instead of being retained until process exit. Code generation also improves polymorphic calls, ARM64 double arithmetic and common string operations.

Supported runtime failures, including invalid numeric parsing and integer division by zero, now throw catchable Dart errors or exceptions. Diagnostics include source locations and are written to stderr.

🔗 Native libraries and C/C++ headers

Declare exports in Dart using FFI types:

import 'dart:ffi';
import 'package:dartc/export.dart';

@Export<Int64 Function(Int64, Int64)>()
int add(int a, int b) => a + b;

@Export<Int64>()
const int answer = 42;
dartc math.dart --emit static -o libmath.a --header math.h

Object, static-library and shared-library outputs are available for macOS and Linux on ARM64 and x86-64. Exports currently cover C-ABI-safe functions and scalar read-only data; managed-runtime exports remain a gap. See supported FFI declarations.

Downloads

Platform Archive
macOS ARM64 dartc-0.5.0-macos-arm64.tar.gz
macOS Intel dartc-0.5.0-macos-x64.tar.gz
Linux ARM64 dartc-0.5.0-linux-arm64.tar.gz
Linux x86-64 dartc-0.5.0-linux-x64.tar.gz

Archive checksums are listed in SHA256SUMS.

Dart package

With Dart SDK ^3.13.7 installed:

dart pub global activate dartc 0.5.0

Full changelog · Changes since 0.4 · Language support