I just tried the following in DartPad:
void main() {
int? x;
}
and get the following error:
Error compiling to JavaScript
Enable the non-nullable experiment with three steps:
Add dart-sdk version into pubspec.yaml
environment:
sdk: '>=2.8.0-dev.0 <2.8.0'
Add enable non-nullable experiment into analysis_options.yaml
analyzer:
enable-experiment:
- non-nullable
Run your Dart code:
dart --enable-experiment=non-nullable ./bin/hello_dart.dart