Because project requires SDK version >=2.14.0 <3.0.0, version solving failed even though Dart SDK version is 2.14.0-350.0.dev

Issue

I want to make use of typedefs for variables in Dart thus I am trying to update minimum dart version to 2.14.0.
When I change environment to

environment:
  sdk: ">=2.14.0 <3.0.0"

I get the following error

[project] flutter pub get
Running "flutter pub get" in project...                      
The current Dart SDK version is 2.14.0-377.0.dev.

Because project requires SDK version >=2.14.0 <3.0.0, version solving failed.
pub get failed (1; Because project requires SDK version >=2.14.0 <3.0.0, version solving failed.)
exit code 1

Now I am confused what >= means if my version is 2.14.something and it does not satisfy condition >=2.14.0.
Any idea what’s going on?

flutter doctor
[√] Flutter (Channel dev, 2.5.0-5.0.pre, on Microsoft Windows [Version 10.0.19043.1110], locale en-GB)
...

Solution

The version of the Dart SDK you have installed is 2.14.0-377.0.dev; the -377.0.dev part indicates that it is a development release (a pre-release), which cannot satisfy a requirement for a stable version of 2.14.0 as required by your pubspec.yaml constraints.

You can set sdk: ">=2.14.0-0 <3.0.0" instead (note the -0) to indicate that you accept development versions of 2.14.0.

Answered By – jamesdlin

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *