Home > Enterprise >  Why is Dart not going into null-safe mode?
Why is Dart not going into null-safe mode?

Time:05-18

For reasons I don't need to go into, I'm trying to get the end_to_end_test subproject of built_value (latest version from google repo on github) to be in null safe mode. It looks like it should be anyway, the sdk version is >=2.12.0 (I changed that to 2.13.0 just to make doubly certain). Running 'dart pub outdated --mode=null-safety' tells me that all dependencies declare null safety. Yet the project remains resolutely not in null safe mode. I've tried googling for things that would prevent null safe mode, but other than a suggestion to try flutter clean (did that) there seems to be nothing.

Can anybody shed any light on this for me? thanks.

CodePudding user response:

The repository you are referring to is using a feature called per-library language version selection. Essentially you can add a comment at the top of a dart file such as // @dart=2.11, which allows you to use an older language version for that file. You can see it being used here for example.

  •  Tags:  
  • dart
  • Related