Skip to content

Allow maintainers to update version constraints of already published packages #4015

Open
@rrousselGit

Description

@rrousselGit

Hello!

Problem

One common issue I've seen is, upperbounds of version constraints (both SDK constraints and dependencies) often tend to be wrong – especially when considering that Dart/Flutter do not respect semver.

This can have negative impact on features such as pub downgrade. Cf dart-lang/sdk#52627 for more discussion on the topic.

For example, since Dart 3, some pkg:watcher versions may trigger the following compilation error:

./../../../../../.puro/shared/pub_cache/hosted/pub.dev/watcher-1.0.2/lib/src/constructable_file_system_event.dart:7:57: Error: The class 'FileSystemEvent' can't be extended, implemented, or mixed in outside of its library because it's a sealed class.

That is because the resolved version is a version that used to subclass a now "final" class (since Dart 3). Yet that watcher version, according to its constraints, is Dart 3 compatible.
So even though that 1.0.2 version of watcher should claim to be incompatible with Dart 3, pub get still works.

This is not a unique aspect of watcher, nor unique to Dart 3. For example, in a Dart 2 minor release, a new flag was added to the File interface. This broke pkg:file because it "implemented' the interface (at least that's what I remember from the error).

Proposal

Could admins of a package override the version constraints of already published packages?

Say a package a is published at version 1.0.0 with the SDK constraint >=3<4, and Dart releases a new version.
If a's 1.0.0 is determined to be incompatible with that new Dart version, would it be possible to flag it directly in the admin panel?

Such that users of the new Dart version would not incorrectly download a v1.0.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions