添加 firebase_database 后无法解决依赖关系

问题描述

我将“firebase_database”添加到 pubspec.yaml 并收到以下错误

[components] Flutter pub 获取 在组件中运行“Flutter pub get”...
因为 firebase_core >=1.0.0 =1.1.1 取决于 firebase_core_platform_interface ^4.0.1,firebase_core >=1.0.0 需要 firebase_core_platform_interface ^4.0.0。

并且因为 firebase_database >=6.1.2 =6.1.2

并且因为 firebase_core_platform_interface >=4.0.0 取决于 plugin_platform_interface ^2.0.0 和 path_provider_platform_interface =6.1.2

并且因为 shared_preferences_windows =6.1.2

并且因为 shared_preferences_windows >=0.0.3-nullsafety =6.0.0 0-dev.1 与 shared_preferences 0.5.12+2 不兼容。

所以,因为组件同时依赖于 shared_preferences 0.5.12+2 和 firebase_database ^6.1.2,版本解析失败。 pub get Failed (1; 所以,因为组件依赖于 shared_preferences 0.5.12+2 和 firebase_database ^6.1.2,版本解析失败。) 退出代码 1

这是我的依赖列表:

 environment:
  sdk: ">=2.7.0 <3.0.0"  
  dependencies:
      Flutter:
        sdk: Flutter
      google_maps_Flutter: ^1.0.6
      http: ^0.12.0
    
      
      json_serializable: ^3.3.0
      bloc: ^6.1.0
      Flutter_bloc: ^6.1.0
      equatable: ^1.2.5
      graphql: ^4.0.1
      graphql_Flutter: ^4.0.1
      Flutter_google_places: ^0.2.4
      google_maps_webservice: ^0.0.16
      fluster: ^1.1.2
      Flutter_cache_manager: ^1.4.1
      sliding_up_panel: ^1.0.2
      image: ^2.1.14
      Flutter_svg: ^0.19.3
      lottie: ^0.6.0
      shared_preferences: '0.5.12+2'
      intl: ^0.17.0
      latlong: ^0.6.1
      polyline: ^1.0.2
      geolocator: ^5.3.1
      auto_size_text_field: ^0.1.7
      path_drawing: ^0.4.1
      Flutter_native_timezone: ^1.0.10
      auto_size_text: ^2.1.0
      charts_Flutter: ^0.10.0
      webview_Flutter: ^2.0.4
      firebase_database: ^6.1.2

解决方法

可能是包的依赖。 但如果你仍然想运行它只是不要指定版本,

只是:

firebase_core:
firebase_database:

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...