Skip to content

Consider recording the exact sdk version in pubspec.lock #4632

@sigurdm

Description

@sigurdm

Currently the pubspec.lock locks down the dependent packages with a content hash (at least for hosted and git packages).

But for the sdk (be it flutter or dart) it records the range of sdks for which the lockfile is valid - the intersection of all the sdk constraints of all dependencies.

This is (as far as I can tell) mainly an optimization, so we don't redo the resolution after upgrading the sdk unless we fall outside the sdk constraint of some package.

Recording the exact sdk version number would help towards the hermeticity of the build.

With pub get we could update the lockfile, and notify the user that the sdk has changed (as we currently do when a package is changed by pub get).

Something along the lines of

> dart pub get # dart 3.8.0
+ Dart SDK 3.8.0

> dart pub get # dart 3.9.0
Resolving dependencies... 
> Dart SDK 3.9.0

With pub get --enforce-lock-file we could fail if the sdk version in production was different from the dev environment.

cc @jakemac53 @jonasfj @szakarias @dcharkes @munificent

WDYT

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