Description
(Filing for discussion, since I'm not sure if this is actually a worthwhile idea.)
Because Flutter doesn't use semver (and we therefore don't allow upper bounds on the SDK constraint), there's no way to prevent the case of someone updating Flutter and then getting mysterious compilation failures in packages. And for many users, when that does happen it's not clear what the problem is. As an example, when platform
recently needed an update to working with a Flutter update (dart-archive/platform#38), we saw a lot of confusion: many bugs filed against Flutter where people didn't know what was happening or what to do, as well as people filing issues and PRs against other packages to update their minimum platform
version (indicating a lack of understanding of how to manage transitive dependencies in cases like this).
Ideally we would want to be able to:
- Give clear messages when this happens ("you need to update package
foo
to versionx
") - Be able to write Flutter tooling that would let people find out what would happen in advance. ("If you update to Flutter 2.19, you will need to update the following packages: ...")
While we don't have the information necessary to do that in the package snapshots themselves, the maintainer of a package often knows before most people would hit the issue. For instance, a common flow would be:
- Someone on
master
orbeta
hits the issue. (For Flutter's 1P packages, this is "our CI alerts us as soon as master starts failing".) - They report it to the package maintainer.
- The maintainer fixes the package and releases an updated version that works with the new version of Flutter.
At that last step, the maintainer is aware that their new version X is the first version that supports Flutter Y, and thus any previous versions of their package are not actually compatible with Flutter Y+, despite what their pubspec versions say. My thought was that perhaps we could provide a simple way for people to submit that information to pub.dev, and we could track it. Possible uses:
- Add it into the resolver and actually enforce it at resolution time. (We'd need to think about the error messages, since it would report something at odds with the pubspec.)
- Instead, add it to a post-resolution step as a warning. (E.g., "You are using version X of package
foo
, which has been reported to be incompatible with your version of Flutter.") - Do neither, but allow for Flutter tooling (at build time, on demand, or both) to use it to inform users.
The main downside I see here is that it requires extra action by maintainers. But it's a small amount of extra action, and there would be some potential incentive for people to do it in the form of getting fewer issue reports.