firedart
firedart copied to clipboard
RPi stream close automatically after some time
I have an app running forepart plugin on a RPi with flutter-pi. I use firebaseCollection.document(docName!).stream to load the database value from firebase. I tried using wifi or network cable but I still have this issue, so is not linked to issue My code is
StreamBuilder<....>(
stream: firebaseCollection.document(docName!).stream,
builder: (context, snapshot) {
if (snapshot.hasData) {
////
}
else {
return Center(child: CircularProgressIndicator());
}
},
),
Any workaround to solve this issue with more code or implementation for firedart?
I am facing the same issue in native dart, streams stop responding after couple of hours without crashing or showing any errors.
This could be from the same reason of other issue that I am facing #43. As the creator of this package wrote
we learned that Firebase actually requires an updated token even after the stream is opened. Firedart currently doesn't do this,
I think this is why your stream is breaking after a while
Unfortunately doing that would require a major rewrite to the entire project, which I currently do not have the time to do. My advice to you would be to use a different package, or not use the real-time stream part of the package.
Tested again now with
yield* ref.stream.handleError((e) => {print('Handling Error Now')});
And
collectionsStream!.onError((e) => {print('Error in real-time stream')});
collectionsStream!.onDone(() => {print('Real-time stream is done')});
None of them showed any response when the stream stop responding.
I think that no matter what the cause of the problem, firedart package should throw us error when the stream stopped working. Maybe we can even try to handle this ourselves by restarting the stream manually or other workaround with our app.
@cachapa do you think that throw error could be more feasible?. Is there area in code that I should start looking from there?.
Tested again now with
yield* ref.stream.handleError((e) => {print('Handling Error Now')});
And
collectionsStream!.onError((e) => {print('Error in real-time stream')}); collectionsStream!.onDone(() => {print('Real-time stream is done')});
None of them showed any response when the stream stop responding.
I think that no matter what the cause of the problem, firedart package should throw us error when the stream stopped working. Maybe we can even try to handle this ourselves by restarting the stream manually or other workaround with our app.
@cachapa do you think that throw error could be more feasible?. Is there area in code that I should start looking from there?.
I agree with you. We could handle the error restarting the stream but how?
For example do you think rebuild the page could be an acceptable option? Or you you have a better option?
@guyluz11 You are working on an stable solution to this bug? In particular are you migrating firedart to use auth from firebase_auth_rest and this will solve the stream issue? Am I right? Fell free to keep me updated with news about. I am creating an app witch need to be stable for September, I am not very expert but I want to help if needed.
EDIT: i see in the issue you opened
, this migration will hopefully solve the problem.
Yes @kekko7072 I am trying to migrate this package to use auth from firebase_auth_rest
.
Unfortunately this on it own didn't solve this issue but it did throw exception. This is good news because in the meantime if exception is thrown than we can catch it and restart the stream ourselves out side of this package. As to how and what is the best way to implement that I will save to the future after my pull request will get accepted.
Maybe patch like this will be implemented inside the package until we will figure out how to solve it correctly, and for you this will just work as if everything is ok without changes.
@kekko7072 I went one step forward and created issue in dart-lang / http
about the null safety crash in firebase_auth_rest
https://github.com/dart-lang/http/issues/581
You can help by saying that this is effecting you too.
Sorry for the late response but I'm under university exams now until the 15th of July :( After that I will try.
Hey @guyluz11 I am back from university exams, any updates? Now I have a full month to work on!
My pull request is waiting for review.
@guyluz11 ok when its ready comment and i Will test It and then close the issue.
@guyluz11 any update?
@kekko7072 I am not the maintainer of this package so it is not on my hands.
Please keep updated in this
https://github.com/cachapa/firedart/pull/67
Don't close the issue, it is important to keep track.
Guys, sorry for my lack of availability for this. I've been ultra busy with my own startup which unfortunately doesn't use Firebase so I haven't had any time for this project.
I'm really not sure what to do here. On the one hand I'm not comfortable with blindly accepting PRs, on the other I feel bad about leaving the community hanging.
Closed by #130