Skip to content

Pub add should resolve any to the workspace constraints #4727

@FMorschel

Description

@FMorschel

Environment

I'm using the latest master at the time of writing (3.11.0-edge.3fbd3ab070aa8a6012b98bbd035a1a0b8886d106 (main) (Tue Dec 16 13:34:00 2025 -0800)).

  • Windows 11 Pro

Problem

I have a project with a pub workspace https://github.com/FMorschel/essential_lints/ (MIT).

In that project, my dev dependencies versions are defined in the workspace pubspec.yaml (but any would do). And all other pubspec.yaml files that need the same dependency use any for the version since it will be resolved by the workspace anyway.

I was recently working (this commit FMorschel/essential_lints@fe8ecc7) on a new test for my docs (I'll publish the package, and we don't yet warn for nonexistent dartdoc macros), and I used dart pub add dev:dartdoc at an inner project folder by mistake, instead of the workspace root folder.

Expected behavior

I expected it to resolve a valid version for dartdoc and write that down in my inner project pubspec.yaml.

Actual behavior

Since that inner file has analyzer: any, this is the output I got:

[package:essential_lints_annotations] dart pub add dartdoc --dev
The current Dart SDK version is 3.11.0-edge.3fbd3ab070aa8a6012b98bbd035a1a0b8886d106.

Because dartdoc <5.0.0 doesn't support null safety and dartdoc >=5.0.0 <5.1.0 depends on analyzer ^3.1.0, dartdoc <5.1.0 requires analyzer ^3.1.0.
And because dartdoc ^5.1.0 depends on analyzer ^3.4.0 and dartdoc >=6.0.0 <6.0.1 depends on analyzer ^4.2.0, dartdoc <6.0.1 requires analyzer ^3.1.0 or ^4.2.0.
And because dartdoc >=6.0.1 <6.1.0 depends on analyzer ^4.3.1 and dartdoc >=6.1.0 <6.1.1 depends on analyzer ^4.7.0, dartdoc <6.1.1 requires analyzer ^3.1.0 or >=4.2.0 <5.0.0.
And because dartdoc >=6.1.1 <6.1.2 depends on analyzer >=4.7.0 <6.0.0 and dartdoc >=6.1.2 <6.1.3 depends on analyzer ^5.1.0, dartdoc <6.1.3 requires analyzer ^3.1.0 or >=4.2.0 <6.0.0.
And because dartdoc >=6.1.3 <6.2.0 depends on analyzer ^5.2.0 and dartdoc >=6.2.0 <6.3.0 depends on analyzer ^5.7.1, dartdoc <6.3.0 requires analyzer ^3.1.0 or >=4.2.0 <6.0.0.
And because dartdoc ^6.3.0 depends on analyzer ^5.12.0 and dartdoc >=7.0.0 <8.0.4 depends on analyzer ^6.3.0, dartdoc <8.0.4 requires analyzer ^3.1.0 or >=4.2.0 <6.0.0 or ^6.3.0.
And because dartdoc >=8.0.4 <8.0.5 depends on analyzer ^6.4.0 and dartdoc >=8.0.5 <8.0.9 depends on analyzer ^6.4.1, dartdoc <8.0.9 requires analyzer ^3.1.0 or >=4.2.0 <6.0.0 or >=6.3.0 <7.0.0.
And because dartdoc >=8.0.9 <8.2.0 depends on analyzer ^6.5.0 and dartdoc >=8.2.0 <8.2.1 depends on analyzer ^6.9.0, dartdoc <8.2.1 requires analyzer ^3.1.0 or >=4.2.0 <6.0.0 or >=6.3.0 <7.0.0.
And because dartdoc >=8.2.1 <8.3.3 depends on analyzer ^6.10.0 and dartdoc >=8.3.3 <8.3.4 depends on analyzer ^7.3.0, dartdoc <8.3.4 requires analyzer ^3.1.0 or >=4.2.0 <6.0.0 or >=6.3.0 <7.0.0 or ^7.3.0.
And because dartdoc ^8.3.4 depends on analyzer ^7.4.4 and dartdoc >=9.0.0 depends on analyzer ^8.2.0, every version of dartdoc requires analyzer ^3.1.0 or >=4.2.0 <6.0.0 or >=6.3.0 <7.0.0 or >=7.3.0 <8.0.0 or ^8.2.0.
So, because essential_lints depends on analyzer ^9.0.0 and essential_lints_annotations depends on dartdoc any, version solving failed.

The lower bound of "sdk: '<3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety
exit code 65

CC @sigurdm

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