I understand that if I cd /tmp
and then dart create code
, I get environment:<newline> sdk: '>=2.10.0 <3.0.0'
in /tmp/code/pubspec.yaml
, which tells me that even though I'm running Dart v. 2.12.3, this (default) configuration does not opt into null safety by default.
But what if I create an empty directory (mkdir /tmp/code
), generate a one-liner program (echo "String a; " > /tmp/code/prog.dart
), chdir (cd /tmp/code
), then run (dart prog.dart
), where will dart look for .dart_data/package_config.json
and package_config.json
?
Update
I'm starting to suspect that the absence of a pubspec.yaml
is not a sanctioned use case for Dart programming. The presence of pubspec.yaml
is the only way that a package can be installed, for example (dart pub add <package-name>
). The ransom result I'm getting (with null safety in one directory; without in another) remains a puzzle, but perhaps if pubspec.yaml
is omitted, then consistency might be too much to ask for.