Home > Mobile >  Dart version mismatch in flutter doctor and pub get
Dart version mismatch in flutter doctor and pub get

Time:09-27

I am trying to install package lottie: ^1.4.3 and getting following error:

The current Dart SDK version is 2.17.1 requires SDK version >=2.18.1 <3.0.0, version solving failed.

I ran flutter doctor -v and it says dart version is 2.18.1

[√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [Version 10.0.19043.2006], locale en-PK)
• Flutter version 3.3.2 on channel stable at E:\Flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e3c29ec00c (12 days ago), 2022-09-14 08:46:55 -0500
• Engine revision a4ff2c53d8
• Dart version 2.18.1
• DevTools version 2.15.0

dart --version output is as follows:

Dart SDK version: 2.18.1 (stable) (Tue Sep 13 11:42:55 2022 0200) on "windows_x64"

I manually changed following in pubspec.yaml

environment:
  sdk: ">=2.18.1 <3.0.0"

I would appreciate if someone could kindly guide me on how to resolve this. I am using Visual Studio Code as the code editor.

CodePudding user response:

You should also check sub project like example folder.

the pub get will check all sub project inside the project, but it will not tell you which one.

CodePudding user response:

Please replace this in pubspec.yaml file.

environment:
  sdk: ">=2.16.2 <3.0.0"
  • Related