In a package where the language version in package_config.json is < 2.9 and a library with a // @dart = 2.9 comment, running dartanalyzer --enable-experiment=non-nullable . prints:
error • This requires the 'non-nullable' language feature to be enabled. • foo.dart:10:20 • experiment_not_enabled
1 error found.
It would be less confusing if the error message said something about not being able to opt in to a newer language version with a comment than what is in the package_config.json. Or potentially even better, if it let you use the experiment anyway. This is on a recent dev SDK.