Invalid version constraint: Cannot include other constraints with "^"

1,372

Solution 1

I have ended up coming here after a websearch, the mistake I did was to add a trailing comma

changed this

flutter_audio_recorder: ^0.5.5,

to

flutter_audio_recorder: ^0.5.5

Solution 2

Current stable version of cupertino_icons is 0.1.2

cupertino_icons: ^0.1.2

The caret sign (^) is used for pub dependencies in Dart to indicate a range of version numbers are allowed. Specifically, any version from the specified version up to (but not including) the next non-breaking version is ok.

Remove + sign after 2

Everything before plus is version name and after is version code and you're not specifying any version code, so remove +.

Share:
1,372
Malwinder Singh
Author by

Malwinder Singh

My Blog LinkedIn

Updated on December 10, 2022

Comments

  • Malwinder Singh
    Malwinder Singh 6 months

    I was studying and practicing basics of Flutter and I got this issue.

    Code:

    dependencies:
      flutter:
        sdk: flutter
      cupertino_icons: ^0.1.2+
      english_words: ^3.1.0
    

    I got error after executing command --no-color packages get:

    Error on line 21, column 20 of pubspec.yaml: Invalid version constraint: Cannot include other constraints with "^" constraint in "^0.1.2+".
      cupertino_icons: ^0.1.2+
                       ^^^^^^^
    pub get failed (65)
    

    Development Platform: Android Studio 3.4 running on Mac OS Mojave