Running pub get in a project with null safety enabled (via with lower SDK constraint), should fail if any of the resolved packages do not support null safety. It should print something like:
Because <name of current package> requires Dart 2.10 with null safety,
and one or more dependencies do not support that, version solving failed.
<list of deps that don't support null safety>
It should be allowed to succeed if a --no-sound-null-safety flag is passed, but then should print a warning:
Warning: getting packages with unsound null safety! Consider upgrading all code to enable sound null safety.
@jonasfj please review
Last we discussed this I believed we came to the conclusion that pub get should merely warn if the resolution ends up in mixed mode.
The reasoning is that there is no real benefit to not just doing what the user says.
I cannot find out if we wrote this anywhere though. jonasfj@ might know when he's back from vacation.
I cannot find out if we wrote this anywhere though. jonasfj@ might know when he's back from vacation.
Yeah, I think we failed to write it down. But I recall the same thing, notably because of the implementation concerns wrt. to pub get --no-sound-null-safety (and the fact that it has no real benefit).
We discussed this in the language team, and agree that we can just do the warning. fyi @sigurdm
Status on this? Is it still planned for the beta release?
Yes I believe so. We procrastinated on landing the PR as we learned that 2.10 was not the version to get null-safety.
Its my understanding that 2.10.0-0 currently is, and will remain, the lowest SDK constraint that enables null safety. There had previously been talk about moving that marker to 2.11.0-0 once 2.10.0 (stable) ships, but I think that was changed @leafpetersen ?
Re the marker being 2.10, see https://github.com/dart-lang/sdk/issues/43031
Are we planning to land this this week? We want to have all the issues closed by Friday 16th.
Are we settled on 2.12 being the first version with the flag on by default?
@sigurdm yes, I think the working theory now is that 2.12 will be the first version with null-safety enabled.
Most helpful comment
Last we discussed this I believed we came to the conclusion that
pub getshould merely warn if the resolution ends up in mixed mode.The reasoning is that there is no real benefit to not just doing what the user says.
I cannot find out if we wrote this anywhere though. jonasfj@ might know when he's back from vacation.