Search code examples
fluttergoogle-cloud-firestorepermissionsexport-to-csvfilepicker

Can't install permission_handler and file_picker because of cloud_firestore


I want to get data from Firestore, put it into a list and enable to user to download data on phone in CSV format by using app.

I found two solutions how to export data to CSV file on phone, but both solutions contains packages which I can't install.

Solution #1 How to create and export csv file in flutter?

Dependencies #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

Problem #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

Solution #2 https://medium.com/flutterdevs/exploring-csv-in-flutter-fafc57b02eb1

Dependencies #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

Problem #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

How to fix one of these problems or is there any another way how to export data to phone via app?

I've never done this before and every advice is welcome.

EDIT

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

Solution

  • In both the cases, you cloud_firestore is way too old. I see that the current version is

    cloud_firestore: ^2.2.0

    So, unless there is some problem with this version, you should migrate it to the latest version, which should be depending on a later version of plugin_platform_interface

    cloud_firestore: ^2.2.0 depends on cloud_firestore_platform_interface: ^5.1.0 which depends on plugin_platform_interface: ^2.0.0.

    So, change your pubsec.yaml file to have,

    cloud_firestore: ^2.2.0
    

    Then run, flutter pub get.