Repository navigation
v2.16.0 - Dart null-safety semantics & null-aware operators
Full Dart null-safety support across parse, type-check, runtime, and transpilation, plus a static null-safety analysis pass and Wasm lowering.
Nullable types
T?on simple, generic, collection and function types (String?,List<String?>,Map<String, User?>,Future<User?>,void Function()?,String? Function(int)).ASTType.nullableviaasNullable()/withoutNullability(); nullability-awareacceptsAssignment(T?acceptsTandNull;TrejectsNull).
Null-aware operators
??, ??=, ?. (getter + method), ?[, postfix ! (standalone and before access: x!.f, x!.m(), x![i]), and .. / ?.. cascades — parsed, evaluated with correct short-circuit semantics, and Dart round-tripped. ?? is the loosest binary operator in the precedence reducer.
Static analysis (new)
NullSafetyAnalyzer — flow-aware: flags null→non-nullable assignment and unchecked nullable access, with if (x != null) promotion and ?./! suppression. Surfaced through the LSP analyzer.
Cross-language generation
- Dart: exact round-trip.
- Kotlin:
?:(Elvis),!!,?., nullableT?. - TypeScript:
??,?.,?.[,!. - C# / JavaScript: native
??. Java / Go / Python / Lua: best-effort.
Wasm
Lowers null-safety within its non-null numeric domain (x!→x, a ?? b→left operand, ?./?[→plain access, T?→numeric type); a null literal remains an explicit unsupported-construct error.
Full test suite green (feature, analyzer, unit, cross-language generation, Wasm codegen, and two declarative .test.xml defs).