firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.73k stars 3.98k forks source link

🐛 [firebase_storage 11.5.1] List() and ListAll() function not working on Windows #11915

Open Sunclicker opened 1 year ago

Sunclicker commented 1 year ago

Bug report

Describe the bug The list() and listAll() functions does not seem to work if the platform is windows. The items list will always be empty. If the plarform is android, everything works as expected.

Steps to reproduce

  1. Upload any file inside a folder in your firebase storage bucket
  2. call this method on a flutter windows app: final ListResult result = FirebaseStorage.instance.ref().child("YOUR_FOLDER_NAME_HERE").listAll()
  3. See that the items list in the result object will always be empty. Even if there are files inside that folder.

Expected behavior

the items list should have some elements inside it.

Flutter doctor

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.13.7, on Microsoft Windows [Version 10.0.19045.3693], locale de-DE) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.0) [√] Android Studio (version 2021.3) [√] VS Code (version 1.84.2) [√] Connected device (3 available) [√] Network resources • No issues found! ```

Flutter dependencies

Click To Expand ``` Dart SDK 3.1.3 Flutter SDK 3.13.7 shopping_navigator 1.0.0+1 dependencies: - badges 3.1.2 [flutter] - cloud_firestore 4.12.1 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - connectivity_plus 5.0.1 [flutter flutter_web_plugins connectivity_plus_platform_interface js meta nm] - cupertino_icons 1.0.6 - firebase_core 2.22.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_storage 11.5.1 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - flutter_launcher_icons 0.13.1 [args checked_yaml cli_util image json_annotation path yaml] - http 1.1.0 [async http_parser meta] - image_compression_flutter 1.0.3 [flutter flutter_web_plugins cross_file flutter_image_compress image_compression] - image_picker 1.0.4 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows] - path 1.8.3 - path_provider 2.1.1 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - shared_preferences 2.2.2 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - sqflite 2.3.0 [flutter sqflite_common path] - sqflite_common_ffi 2.3.0+2 [sqlite3 sqflite_common synchronized path meta] - uuid 4.1.0 [crypto sprintf] dev dependencies: - flutter_lints 1.0.4 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] transitive dependencies: - _flutterfire_internals 1.3.12 [collection firebase_core firebase_core_platform_interface flutter meta] - archive 3.4.6 [crypto path pointycastle] - args 2.4.2 - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - cli_util 0.4.0 [meta path] - clock 1.1.1 - cloud_firestore_platform_interface 6.0.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.8.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.17.2 - connectivity_plus_platform_interface 1.2.4 [flutter meta plugin_platform_interface] - convert 3.1.1 [typed_data] - cross_file 0.3.3+6 [js meta] - crypto 3.0.3 [typed_data] - dbus 0.7.8 [args ffi meta xml] - fake_async 1.3.1 [clock collection] - ffi 2.1.0 - file 7.0.0 [meta path] - file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.3+3 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.6.1 [cross_file flutter http plugin_platform_interface] - file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.8.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_storage_platform_interface 5.0.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.6.13 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - flutter_image_compress 1.1.3 [flutter] - flutter_plugin_android_lifecycle 2.0.16 [flutter] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image 4.1.3 [archive meta xml] - image_compression 1.0.4 [image mime path] - image_picker_android 0.8.8+1 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 3.0.1 [flutter flutter_web_plugins image_picker_platform_interface mime] - image_picker_ios 0.8.8+2 [flutter image_picker_platform_interface] - image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_platform_interface 2.9.1 [cross_file flutter http plugin_platform_interface] - image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface] - js 0.6.7 [meta] - json_annotation 4.8.1 [meta] - lints 1.0.1 - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - meta 1.9.1 - mime 1.0.4 - nm 0.5.0 [dbus] - path_provider_android 2.2.1 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.1 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.1 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - petitparser 5.4.0 [meta] - platform 3.1.3 - plugin_platform_interface 2.1.6 [meta] - pointycastle 3.7.3 [collection convert js] - shared_preferences_android 2.2.1 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.3.4 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.2 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.1 [flutter plugin_platform_interface] - shared_preferences_web 2.2.1 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.3.2 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - sprintf 7.0.0 - sqflite_common 2.5.0 [synchronized path meta] - sqlite3 2.1.0 [collection ffi js meta path] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - string_scanner 1.2.0 [source_span] - synchronized 3.1.0 - term_glyph 1.2.1 - test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - typed_data 1.3.2 [collection] - vector_math 2.1.4 - web 0.1.4-beta - win32 5.0.9 [ffi] - xdg_directories 1.0.3 [meta path] - xml 6.3.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```

huycozy commented 1 year ago

Thanks for the report. I can reproduce this issue on Windows using firebase_storage sample code and update it as below:

  Future<void> _downloadLink(Reference ref) async {
    final link = await ref.getDownloadURL();

    final result = await FirebaseStorage.instance.ref().child("flutter-tests").list();
    print('result: $result: ${result.items.length}');
...
flutter: result: Instance of 'ListResult': 0

Then just run the app and press on copy link button.

flutter doctor -v ```bash [√] Flutter (Channel stable, 3.16.0, on Microsoft Windows [Version 10.0.19045.3570], locale en-US) • Flutter version 3.16.0 on channel stable at C:\WIP\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision db7ef5bf9f (5 hours ago), 2023-11-15 11:25:44 -0800 • Engine revision 74d16627b9 • Dart version 3.2.0 • DevTools version 2.28.2 [√] Windows Version (Installed version of Windows is version 10 or higher) [!] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\AndroidSDK • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = C:\AndroidSDK • Java binary at: C:\Program Files\Android\Android Studio Electric Eel 2022.1.1\jbr\bin\java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) X Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4) • Visual Studio at D:\DOWNLOADWORK\VS2022 • Visual Studio Community 2022 version 17.4.33213.308 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2021.2) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) [√] Android Studio (version 2022.1) • Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) [√] VS Code (version 1.84.2) • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.76.0 [√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3570] • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.124 • Edge (web) • edge • web-javascript • Microsoft Edge 119.0.2151.58 [√] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```
Lyokone commented 11 months ago

Hello @Sunclicker, thanks for reporting, the C++ Desktop SDK currently does not support List or ListAll functions, when it is added to the C++ SDK we will be able to add support to Windows.

mavyfaby commented 10 months ago

is there any workaround on this?

Sunclicker commented 10 months ago

is there any workaround on this?

I didn't find any workaround. Therefore I used Supabase (firebase alternative) for storing data (at least for windows apps). Works great.

yegor-pelykh commented 7 months ago

Is there any time frame for implementing this feature? Otherwise I'll have to switch to Supabase.

Sunclicker commented 4 months ago

Since it does not look like this can be fixed in the next few months I think it will be better if an exception will be thrown instead of just returning an empty list.

luettelo commented 1 month ago

I also tumbeled on this issue. Is there planned solution from the maintainers? Issue seems to be still open

cyberpwnn commented 1 month ago

Apparently no plans to fix it. Just wait it out and the google bot will auto close the issue :P