Skip to content

Can the @Since annotation be made usable for packages? #52627

@rrousselGit

Description

@rrousselGit

The SDK uses a custom annotation for warnings: @Since('version').

This warning is helpful to help folks with changing their version constraints to match what they use in their application.
This is especially useful in Dart as it is installed globally instead of on a per-project basis. But there are other use-cases.

I think opening this annotation to Flutter and package authors would be helpful too.

In general, it is very difficult to know what is the actual minimum version possible of a dependency based on what a package uses.
A package may specify dependency: ^1.0.0, yet use a feature only available since v1.2.0 – because when the package was first developed, 1.2.0 was available.

As such, the package author may think their package is compatible with dependency: 1.1.0, when it actually isn't. So if an application depends on our package but also uses an older dependency version, it will get a funky compilation error (in the best-case scenario) instead of pub failing to resolve the pub get.

By opening up this annotation to package authors, folks could start annotating new APIs with @Since when they are introduced. This would help the community as a whole deal with minimum version constraints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-warningIssues with the analyzer's Warning codestype-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