-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
This came up in flutter/flutter#69440 (comment) where a bunch of flutter/plugins packages started failing on CI.
@zanderso and @leafpetersen pointed out that the failing packages included example apps with no Dart SDK constraints which means they are treated as opted-in for null safety.
While the flutter/plugins packages are fixed in flutter/plugins#3240 it's somewhat worrying that many other packages in the ecosystem will take a similar hit.
I counted the affected packages across pub and there are currently 725 packages with example apps that are opted-in for null safety (most likely unintentionally as null safety isn't launched yet).
698 of these packages are actually not opted-in for null safety (e.g the root pubspec.yaml isn't opted-in while example/pubspec.yaml is opted in).
For these 698 packages I believe it should be safe to assume that the sdk constraint in example/pubspec.yaml should be intersected with the sdk constraints of the root pubspec.yaml. So it's fairly easy to automate the fix.
The list of the 698 "fixable" packages is available in this sheet.
I'm happy to send PRs using dart_lsc to fix example/pubspec.yaml for as many of these 698 packages as possible.
I guess another alternative to consider would be to somehow teach the analyzer that the example app's sdk constraint cannot be wider than the package's sdk constraint.