Flutter版本解决因cloud_firestore和firebase_core而失败

时间:2020-11-03 14:54:12

标签: firebase flutter google-cloud-firestore

运行pub getpub upgrade会导致以下错误:

Running "flutter pub upgrade" in <project-name>...      

Because cloud_firestore >=0.13.3 <0.14.0-dev.1 depends on firebase_core ^0.4.4 and cloud_firestore >=0.11.0 <0.13.3 depends on firebase_core ^0.4.0, cloud_firestore >=0.11.0 <0.14.0-dev.1 requires firebase_core ^0.4.0.
So, because <project-name> depends on both cloud_firestore ^0.13.0+1 and firebase_core ^0.5.0+1, version solving failed.
pub upgrade failed (1; So, because <project-name> depends on both cloud_firestore ^0.13.0+1 and firebase_core ^0.5.0+1, version solving failed.)

我的pubspec.yaml

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: ^0.13.0+1
  provider: ^4.3.2+2
  google_sign_in: "^4.5.1"
  firebase_core: "^0.5.0+1"
  firebase_auth: "^0.18.1+2"

该项目是根据上周的官方指南创建的。

2 个答案:

答案 0 :(得分:0)

pubspec.yml中增加cloud_firestory版本可以解决此问题:

  cloud_firestore: ^0.14.0+1

答案 1 :(得分:0)

只需升级 Flutter,即可使用 CLI 命令 flutter upgrade 将 Dart SDK 升级到最新版本。