添加Firebase依赖关系后Flutter'Packages get'失败

时间:2019-03-10 08:23:42

标签: firebase flutter

我正在尝试将Firebase添加到我的flutter应用程序中。但是,当我在pubspec_yaml中添加firebase_core依赖项并运行Packages get时,会出现错误。

19-----dependencies:
20-----flutter:
21-----sdk: flutter
22-----firebase_core: ^0.2.5 

这是给出错误的代码。

Packages的输出为:

C:\flutter\bin\flutter.bat --no-color packages get
Running "flutter packages get" in trial_one...                  
Error on line 21, column 5 of pubspec.yaml: A dependency may only have one source.
sdk: flutter
^^^^^^^^^^^^^^


pub get failed (65)
Process finished with exit code 65

我遵循了Add Firebase to Flutter网站上的确切说明。但我仍然收到此错误。

1 个答案:

答案 0 :(得分:0)

缩进实际上不好,这是正确的:

dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^0.3.1+1

希望有帮助!!