As of Dart 2.12.0
, null safety is enabled by default.
The "Enabling null safety" section on dart.dev
states the following:
Set the SDK constraints to require a language version that has null safety support. For example, your pubspec.yaml file might have the following constraints:
environment: sdk: ">=2.12.0-0 <3.0.0"
So now that it is enabled by default, how do we opt out of null safety and write code like before when our SDK constraint has >=2.12.0-0
?
We might want to require a Dart version like this for a different language feature but not want to use NNBD.