1. 程式人生 > >flutter_test from sdk is forbidden?

flutter_test from sdk is forbidden?

報錯資訊:

Because every version of flutter_test from sdk depends on collection 1.14.11 and flutter_app depends on collection 1.14.6, flutter_test from sdk is forbidden.
So, because flutter_app depends on flutter_test any from sdk, version solving failed.

collection 版本不一致,修改依賴:
pubspec.lock(pub檔案)下找到collection

,黏貼以下程式碼(版本選擇可以自己定義)

 collection:
      dependency: transitive
      description:
        name: collection
        url: "https://pub.dartlang.org"
      source: hosted
      version: "1.14.11"

在.yaml檔案裡,dependencies下,與上面保持一致

collection: ^1.14.11

Packages get 如果報:

Expected a key while parsing a block mapping.
   collection:
   ^

可不用管,直接run就好。
如果報SDK版本衝突,把對應的依賴,按照上面的collection的操作依賴,版本升級就好,如果不知道最新版本是多少,安利一波:flutter各種依賴