felangel / mocktail

A mock library for Dart inspired by mockito
https://pub.dev/packages/mocktail
MIT License
617 stars 81 forks source link

syntax error on dart sdk version with Flutter 3.0.3 #137

Closed melissa-q-amica closed 1 year ago

melissa-q-amica commented 2 years ago

Describe the bug

When upgrading to flutter 3.0.3 I received the following error: Expected version number after ">=" in ">=2.12-0-0 <3.0.0", got "2.12-0-0 <3.0.0".

Manually changing the version to 2.12.0 resolved this issue. I believe the hyphens or dashes are causing a syntax error.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Logs Run flutter analyze and attach any output of that command below. If there are any analysis errors, try resolving them before filing this issue.

Paste the output of running flutter doctor -v here.

Additional context Add any other context about the problem here.

felangel commented 2 years ago

Hi @melissa-q-amica 👋 Thanks for opening an issue!

Can you clear your pub cache and try again?

dart pub cache clean
bojanivanovski commented 2 years ago

Issue still occurs after dart pub cache clean

regisksc commented 2 years ago

I'm also experiencing this bug with Mocktail and Mockingjay.

Changing sdk to 2.12.0 does not solve it.

Error message: Invalid version constraint: Expected version number after ">=" in ">=2.12-0-0 <3.0.0", got "2.12-0-0 <3.0.0".

felangel commented 2 years ago

I would recommend removing mocktail from pub-cache and reinstalling. Also please ensure you're using the latest version of mocktail by checking the version in your pubspec.lock.

If you're still having trouble can you please share a link to a minimal reproduction sample? Thanks!

regisksc commented 2 years ago

I would recommend removing mocktail from pub-cache and reinstalling. Also please ensure you're using the latest version of mocktail by checking the version in your pubspec.lock.

If you're still having trouble can you please share a link to a minimal reproduction sample? Thanks!

my flutter doctor:

[✓] Flutter (Channel stable, 3.0.5, on macOS 11.4 20F5046g darwin-x64, locale pt-BR) • Flutter version 3.0.5 at /Users/regisksc/Dev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (4 weeks ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/regisksc/Library/Android/sdk ✗ cmdline-tools component is missing Run path/to/sdkmanager --install "cmdline-tools;latest" See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Run flutter doctor --android-licenses to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.70.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.46.0

[✓] VS Code • VS Code at /Users/regisksc/Downloads/Visual Studio Code.app/Contents • Flutter extension version 3.46.0

[✓] Connected device (3 available) • iPhone 13 Pro Max (mobile) • 8144C65E-EE21-4B39-A922-A3326C57861D • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.4 20F5046g darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.109

[✓] HTTP Host Availability • All required HTTP hosts are available

I'm currently not testing android.

I've run: dart pub cache clean

pubspec.yaml:

mocktail: ^0.3.0

when running flutter pub get:

Error on line 8, column 8 of /Users/regisksc/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/mocktail-0.1.2/pubspec.yaml: Invalid version constraint: Expected version number after ">=" in ">=2.12-0-0 <3.0.0", got "2.12-0-0 <3.0.0". ╷ 8 │ sdk: ">=2.12-0-0 <3.0.0" │ ^^^^^^^^^^^^^^^^^^^ ╵ pub get failed (65; ╵) exit code 65

#### EDIT:

manually changing mocktail's pubspec sdk version to 2.12.0 <3.0.0 makes it work.
did so by editing with:
nano /$PATH_TO_FLUTTER/.pub-cache/hosted/pub.dartlang.org/mocktail-0.1.2/pubspec.yaml