skip to Main Content

I am trying to add mocktail from pub.dev into pubspec.yaml but not able to add it after updating to flutter 3.3.2. I tried changing the environment parameter to

environment:
  sdk: ">=2.12.0 <3.0.0"

dev_dependencies:
  flutter_test:
      sdk: flutter

    flutter_lints:
    flutter_launcher_icons: ^0.10.0
    integration_test:
      sdk: flutter
    mocktail:

but the problem did not get solved.

Error on line 1, column 1 of ....flutter_windows_v1.12.13Baseflutter.pub-
cachehostedpub.dartlang.org.cachemocktail-versions.json: Invalid version constraint:
Expected version number after ">=" in ">=2.12-0-0 <3.0.0", got "2.12-0-0 <3.0.0".

pub get failed (65; Error on line 1, column 1 of 
....flutter_windows_v1.12.13Baseflutter.pub-
cachehostedpub.dartlang.org.cachemocktail-versions.json: Invalid version constraint:
 Expected version number after ">=" in ">=2.12-0-0 <3.0.0", got "2.12-0-0 <3.0.0".)

Process finished with exit code 65



flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [Version
    10.0.22623.1095], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019
    16.11.10)
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.74.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

• No issues found!

2

Answers


  1. Chosen as BEST ANSWER

    This answer from River2202 worked for me:

    You can remove /Users/myname/.pub-cache/ and try again. It caches some different version of package when you have multiple flutter versions or installed different versions of flutter.


  2. environment:
      sdk: '>=2.18.2 <3.0.0'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search