Non-nullable by default: how to enable the experiment?
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
Add the following line to the analysis_options.yaml
analyzer:
enable-experiment:
- non-nullable