由于 cloud_firestore,无法安装 permission_handler 和 file_picker

Can't install permission_handler and file_picker because of cloud_firestore

我想从 Firestore 获取数据,将其放入列表中,并允许用户使用应用程序以 CSV 格式下载 phone 上的数据。

我在 phone 上找到了两个如何将数据导出到 CSV 文件的解决方案,但是这两个解决方案都包含我无法安装的包。

解决方案 #1 How to create and export csv file in flutter?

依赖项 #1

dependencies:
  page_view_indicators: ^2.0.0
  syncfusion_flutter_xlsio: ^19.1.64-beta
  csv: ^5.0.0
  ext_storage: ^1.0.3
  permission_handler: ^8.0.0+1
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2

问题 #1

Because cloud_firestore >=0.13.1 <0.14.0-dev.1 depends on cloud_firestore_platform_interface ^1.0.0 which depends on plugin_platform_interface ^1.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 requires plugin_platform_interface ^1.0.0.

And because permission_handler >=8.0.0 depends on permission_handler_platform_interface ^3.5.0 which depends on plugin_platform_interface ^2.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 is incompatible with permission_handler >=8.0.0.

So, because gamiforms depends on both permission_handler ^8.0.0+1 and cloud_firestore ^0.13.3, version solving failed.
pub get failed (1; So, because gamiforms depends on both permission_handler ^8.0.0+1 and cloud_firestore ^0.13.3, version solving failed.)
exit code 1

解决方案 #2 https://medium.com/flutterdevs/exploring-csv-in-flutter-fafc57b02eb1

依赖项 #2

dependencies:
  page_view_indicators: ^2.0.0
  syncfusion_flutter_xlsio: ^19.1.64-beta
  csv: ^5.0.0
  ext_storage: ^1.0.3
  file_picker: ^3.0.1
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2

问题 #2

Because cloud_firestore >=0.13.1 <0.14.0-dev.1 depends on cloud_firestore_platform_interface ^1.0.0 which depends on plugin_platform_interface ^1.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 requires plugin_platform_interface ^1.0.0.

And because file_picker >=3.0.0-nullsafety.3 depends on plugin_platform_interface ^2.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 is incompatible with file_picker >=3.0.0-nullsafety.3.

So, because gamiforms depends on both file_picker ^3.0.1 and cloud_firestore ^0.13.3, version solving failed.
pub get failed (1; So, because gamiforms depends on both file_picker ^3.0.1 and cloud_firestore ^0.13.3, version solving failed.)
exit code 1

如何解决其中一个问题,或者是否有其他方法可以通过应用程序将数据导出到 phone?

我以前从未这样做过,欢迎大家提出建议。

编辑

dev_dependencies:
  flutter_test:
    sdk: flutter
  cached_network_image: ^2.0.0
  cloud_firestore: ^0.13.3
  firebase_auth: ^0.15.2
  provider: ^3.2.0
  #google_sign_in: ^4.1.1
  shared_preferences: ^0.5.6+3
  random_string: ^2.0.1

在这两种情况下,您 cloud_firestore 都太老了。我看到当前版本是

cloud_firestore: ^2.2.0

所以,除非这个版本有什么问题,否则你应该把它迁移到最新版本,这应该取决于以后的版本plugin_platform_interface

cloud_firestore: ^2.2.0 取决于 cloud_firestore_platform_interface: ^5.1.0 取决于 plugin_platform_interface: ^2.0.0.

所以,将您的 pubsec.yaml 文件更改为

cloud_firestore: ^2.2.0

然后运行,flutter pub get.