-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Bug report
Describe the bug
When using the onValue listener with a TabController as the parent view (I had two listeners each on a separate tab), and navigating from tabs and back, Bad state: Stream has already been listened to. is thrown.
Also on a separate note, I came across this bug while dealing with another on onValue streams, where a No implementation found for method cancel on channel usage-counter/moOmk97GjEV1QMaQ2HiVz6y82sl1-[DEFAULT]-null-DatabaseEventType.value-[]#6 is thrown when navigating in the TabView on a separate app. I was unable to replicate this, but I wonder if it's a similar issue, so I'll include it here. Sorry if it isn't and this information is redundant. I cannot share the code for the application that threw this exception, but will share the one with the Stream listen error.
Steps to reproduce
Steps to reproduce the behavior:
- Open the Sample Repo
- Run the Code
- Go back and forth between tabs
- See the thrown
StateError
Expected behavior
The StreamController should continue to function across tab navigation
Sample project
https://github.com/tmthecoder/database_stream_bug
Additional context
None except the mention about the other error I received. In the case this is a lower priority issue, I can work on a fix if an issue is found. I couldn't seem to pinpoint it myself when looking through the firebase_database implementation.
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.8.0, on macOS 12.0.1 21A559 darwin-x64, locale
en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.1)
[✓] Connected device (3 available)
! Doctor found issues in 1 category.
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
Dart SDK 2.15.0
Flutter SDK 2.8.0
firebase_database_bug_sample 1.0.0+1
dependencies:
- cupertino_icons 1.0.4
- firebase_core 1.10.5 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_database 9.0.3 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
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 meta source_span stream_channel string_scanner term_glyph typed_data]
transitive dependencies:
- async 2.8.2 [collection meta]
- 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
- fake_async 1.2.0 [clock collection]
- firebase_core_platform_interface 4.2.2 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.5.2 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_database_platform_interface 0.2.0+2 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_database_web 0.2.0+2 [firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins js]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- js 0.6.3
- lints 1.0.1
- matcher 0.12.11 [stack_trace]
- meta 1.7.0
- path 1.8.0
- plugin_platform_interface 2.0.2 [meta]
- 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]
- term_glyph 1.2.0
- test_api 0.4.3 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- vector_math 2.1.1