🐛 [cloud_firestore] Snapshot stream doesn't return any data on navigation to new page on flutter web
Bug report
Describe the bug
I have a snapshot stream that I want to access on multiple pages.
I'm using the StreamBuilder to listen to the Stream and create a list of the text widget with the snapshot data.
on the navigation to the second page, I'm passing an object that contains the snapshot stream, on the second page I have the same StreamBuilder, and it listening to the snapshot stream from the passed object but there is no data and the ConnectionState stuck on waiting.
This behavior is only on the web it works fine on android
Steps to reproduce
Steps to reproduce the behavior:
- Listen on snapshot stream
- Navigate to a new page and pass the object that contains the stream snapshot
- Try to listen to the snapshot stream on the new page
- ConnectionState stuck on waiting and there is no data
Expected behavior
was expected to return data
Additional context
I have created a new Firebase project and a new Flutter app also created a snapshot stream of data from Firestore and a simple count down ticker stream. The ticker stream worked on both pages. the data stream from Firestore worked only on the first page, after navigating to the second page it didn't get any data
you can check there this repo https://github.com/bigblackclock/stream_debug_web
Flutter doctor
Run flutter doctor and paste the output below:
Click To Expand
[√] Flutter (Channel beta, 1.23.0-18.1.pre, on Microsoft Windows [Version 10.0.19042.746],
locale en-DE)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 3.6)
[√] IntelliJ IDEA Ultimate Edition (version 2019.3)
[√] VS Code (version 1.52.1)
[√] Connected device (4 available)
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
Dart SDK 2.11.0-213.1.beta
Flutter SDK 1.23.0-18.1.pre
stream_debug_web 1.0.0+1
dependencies:
- cloud_firestore 0.16.0 [flutter meta quiver firebase_core firebase_core_platform_interface
cloud_firestore_platform_interface cloud_firestore_web]
- cupertino_icons 1.0.0
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_messaging 8.0.0-dev.14 [meta flutter firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]
transitive dependencies:
- async 2.5.0-nullsafety.1 [collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- clock 1.1.0-nullsafety.1
- cloud_firestore_platform_interface 3.0.1 [flutter meta collection firebase_core plugin_platform_interface]
- cloud_firestore_web 0.3.0+1 [flutter flutter_web_plugins http_parser meta firebase_core firebase_core_web cloud_firestore_platform_interface js]
- collection 1.15.0-nullsafety.3
- fake_async 1.2.0-nullsafety.1 [clock collection]
- firebase_core_platform_interface 3.0.1 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+3 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- firebase_messaging_platform_interface 1.0.0-dev.10 [flutter meta firebase_core plugin_platform_interface]
- firebase_messaging_web 0.1.0-dev.5 [flutter flutter_web_plugins meta firebase_core firebase_core_web firebase_messaging_platform_interface js service_worker]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- js 0.6.3-nullsafety.1
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.4
- path 1.8.0-nullsafety.1
- plugin_platform_interface 1.0.3 [meta]
- quiver 2.1.5 [matcher meta]
- service_worker 0.2.4 [js]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- stack_trace 1.10.0-nullsafety.2 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0-nullsafety.3 [collection]
- vector_math 2.1.0-nullsafety.3
@bigblackclock Thanks for the repo. I cloned it and was able to reproduce it on latest beta. Navigating to second page isn't showing the data.
flutter doctor -v
[✓] Flutter (Channel beta, 1.25.0-8.2.pre, on Mac OS X 10.15.4 19E2269
darwin-x64, locale en-IN)
• Flutter version 1.25.0-8.2.pre at /Users/dhs/documents/Fluttersdk/flutter
• Framework revision b0a2299859 (2 weeks ago), 2021-01-05 12:34:13 -0800
• Engine revision 92ae191c17
• Dart version 2.12.0 (build 2.12.0-133.2.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at /Users/dhs/Library/Android/sdk
• Platform android-30, build-tools 30.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.9.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• 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
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (2 available)
• SM A260G (mobile) • 5200763ebcfa861f • android-arm • Android 8.1.0 (API
27)
• Chrome (web) • chrome • web-javascript • Google Chrome
87.0.4280.141
• No issues found!
Same on iOS and Web.
- flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.26.0-17.3.pre, on Mac OS X 10.14.6 18G103 darwin-x64, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[!] Xcode - develop for iOS and macOS
! Xcode 11.3.1 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.53.0)
[✓] Connected device (2 available)
....
! Doctor found issues in 2 categories.
Same on iOS and Web.
- flutter doctor
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel beta, 1.26.0-17.3.pre, on Mac OS X 10.14.6 18G103 darwin-x64, locale pt-BR) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [!] Xcode - develop for iOS and macOS ! Xcode 11.3.1 out of date (12.0.1 is recommended). Download the latest version or update via the Mac App Store. [✓] Chrome - develop for the web [!] Android Studio (not installed) [✓] VS Code (version 1.53.0) [✓] Connected device (2 available) .... ! Doctor found issues in 2 categories.
Fixing WEB Issues using 7.2.0 version of JS libraries into index.html like following:
<script src="https://www.gstatic.com/firebasejs/7.2.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.2.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.2.0/firebase-firestore.js"></script>