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.66k stars 3.96k forks source link

🐛 Realtime Database: once() not working on macos #8229

Closed gottfired closed 2 years ago

gottfired commented 2 years ago

Bug report

Calling once() for a realtime db query does not work on macos. Same query works on web.

Steps to reproduce

Steps to reproduce the behavior:

  1. Set up realtime db
  2. I used the following query:
  3. Query query = FirebaseDatabase.instance.ref('highScores').orderByChild("score").limitToLast(leaderboardSize); final event = await query.once(); print("Event: ${event}");
  4. On web the event contains a snapshot. On macos nothing is printed, but also no exception is thrown, which is very weirde. So not sure, what is going on.

Expected behavior

Same behaviour on macos as on web.

Sample project

Error occured during my flutter puzzle hack implementation. I've marked the line where the error occurs in the link below

https://github.com/gottfired/flutter_puzzle/blob/5d3e4f25d745c809033135d5edc9b976f6072b42/lib/leaderboard.dart#L18

Additional context

Also tried including the GoogleService-Info.plist, which according to newest flutterfire docs isn't necessary anymore. But also didn't work, so reverted back to dart initialization.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.10.1, on macOS 11.6.4 20G417 darwin-x64, locale en-AT) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [✓] VS Code (version 1.65.0) [✓] Connected device (2 available) [✓] HTTP Host Availability • No issues found! ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.16.1 Flutter SDK 2.10.1 pushtrix 1.0.0+1 dependencies: - animated_button 0.2.0 [flutter] - cupertino_icons 1.0.4 - firebase_core 1.13.1 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_database 9.0.8 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter] - flame_audio 1.0.0 [flame audioplayers synchronized flutter] - flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine] - shared_preferences 2.0.13 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] dev dependencies: - flutter_lints 1.0.4 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph typed_data] transitive dependencies: - async 2.8.2 [collection meta] - audioplayers 0.20.1 [uuid path_provider http flutter flutter_web_plugins] - boolean_selector 2.1.0 [source_span string_scanner] - characters 1.2.0 - charcode 1.3.1 - clock 1.1.0 - collection 1.15.0 - crypto 3.0.1 [collection typed_data] - fake_async 1.2.0 [clock collection] - ffi 1.1.2 - file 6.1.2 [meta path] - firebase_core_platform_interface 4.2.5 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.6.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_database_platform_interface 0.2.1+1 [collection firebase_core flutter meta plugin_platform_interface] - firebase_database_web 0.2.0+7 [firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins js] - flame 1.0.0 [flutter meta collection ordered_set vector_math] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math] - http 0.13.4 [async http_parser meta path] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - js 0.6.3 - lints 1.0.1 - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.3 - meta 1.7.0 - ordered_set 5.0.0 - path 1.8.0 - path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows] - path_provider_android 2.0.11 [flutter path_provider_platform_interface] - path_provider_ios 2.0.7 [flutter path_provider_platform_interface] - path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.5 [flutter path_provider_platform_interface] - path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface] - path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - process 4.2.4 [file path platform] - shared_preferences_android 2.0.10 [flutter shared_preferences_platform_interface] - shared_preferences_ios 2.0.9 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.0.4 [file flutter path path_provider_linux shared_preferences_platform_interface] - shared_preferences_macos 2.0.2 [flutter shared_preferences_platform_interface] - shared_preferences_platform_interface 2.0.0 [flutter] - shared_preferences_web 2.0.3 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.0.4 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - sky_engine 0.0.99 - source_span 1.8.1 [collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - synchronized 3.0.0 - term_glyph 1.2.0 - test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.0 [collection] - uuid 3.0.5 [crypto] - vector_math 2.1.1 - win32 2.3.11 [ffi] - xdg_directories 0.2.0+1 [meta path process] ```

darshankawar commented 2 years ago

Thanks for the report. Using the plugin example and running it on macOS, I do see the same behavior as reported.

This line of code print("Event: ${event}"); isn't returning anything.

Channel master, 2.11.0-0.0.pre.818

russellwheatley commented 2 years ago

I've just tested this against the latest firebase_database and it now prints out the event 👍