New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to reset BehaviorSubject #233
Comments
You cannot reset a If you wish to discard the |
@frankpepermans
It's working perfectly. But is this approach correct? |
Any reason why you are using BehaviorSubject? I assume you recreate the subjects because you don't want the last event to trigger immediately? Maybe try a regular PublishSubject or StreamController, and return a deferred Stream in the getters instead? |
I am using BehaviorSubject to get the final value of the text entered by user in the Stream. As user will be adding some message in text field. My intention is to validate that message and upload the final text to the server. |
@frankpepermans |
Well, you could always bundle regular Subjects, not Behavior, using combineLatest? Then submit whenever the onClick Stream of the submit button fires? |
closing this (not an issue) perhaps move it to stack overflow for example? |
The operator '[]' isn't defined for the type 'Map<String, dynamic> Function()'. |
@Sreejithtechno more detail please 🥺 Sent from my Redmi 7A using FastHub |
I am having an issue draining or closing the BehaviorSubject. It always given me the final value even after draining or closing it. How can I fix it? Here is my code:
link to the repo: https://github.com/SAGARSURI/Goals
This is my BLoC class. The
_title
and_goalMessage
always pass the last stored value to theStreamBuilder
:The text was updated successfully, but these errors were encountered: