Home > Software engineering >  Not able to add mocktail to my flutter project
Not able to add mocktail to my flutter project

Time:01-11

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.13Base\flutter\.pub-
cache\hosted\pub.dartlang.org\.cache\mocktail-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.13Base\flutter\.pub-
cache\hosted\pub.dartlang.org\.cache\mocktail-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!

CodePudding user response:

From River2202 worked for me. https://stackoverflow.com/a/73549623/2131651

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.

CodePudding user response:

environment:
  sdk: '>=2.18.2 <3.0.0'
  • Related