【问题标题】:Invalid version constraint: Cannot include other constraints with "^"无效的版本约束:不能用“^”包含其他约束
【发布时间】:2019-09-10 08:11:27
【问题描述】:

我在学习和练习 Flutter 的基础知识时遇到了这个问题。

代码:

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

执行命令--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)

开发平台: 在 Mac OS Mojave 上运行的 Android Studio 3.4

【问题讨论】:

    标签: dart flutter dart-pub flutter-dependencies


    【解决方案1】:

    cupertino_icons 当前的稳定版本是0.1.2

    cupertino_icons: ^0.1.2
    

    插入符号 (^) 用于 Dart 中的 pub 依赖项,表示允许的版本号范围。具体来说,从指定版本到(但不包括)下一个非破坏版本的任何版本都可以。

    去掉 2 之后的 + 号

    加号之前是版本名称,之后是版本代码,您没有指定任何版本代码,所以删除+。

    【讨论】:

      【解决方案2】:

      我在网络搜索后最终来到这里,我犯的错误是添加了尾随逗号

      改变了这个

      flutter_audio_recorder: ^0.5.5,
      

      flutter_audio_recorder: ^0.5.5
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多