Closed h-unterp closed 2 years ago
@hunterpp Thanks for the detailed report. From the code you shared above, it seems you are using provider which is third party. Does the same behavior persist without using provider package ? If so, can you provide updated code sample without using it ?
Hi! What exactly do you mean by "3rd party provider"?
If by the invertase binary in the podfile, Ok.
But I fail to see how that binary would affect flutter web which is where the bug exists.
Since you are using var state = Provider.of<TheState>(context, listen: false);
, I meant to ask, if the same behavior is replicable using the provider package, ie, using flutter's core code.
Sorry, I am new to Flutter. So I don't understand what you mean
@hunterpp Can you try the plugin's official example and see if you still get same behavior as you reported ?
Yes thank you, confirmed the official example works. Wondering what the difference between my code and the example is. My code is quite the minimal reproduction of the issue, is it using the API incorrectly? Or is this actually a bug? Thank you.
@hunterpp Looks like an implementation issue since the official example works as I verified as well. Please re-visit your implementation and compare it with the example and see where you could be missing a piece.
Closing for now, as using plugin example, the onChildAdded.listen()
works as expected. If you disagree, write in comments and I'll reopen it.
Summary
In Flutter web, It seems that when I call
.onChildAdded.listen()
on my firebase realtime database connection, that it just stops working. If I uncomment.onChildAdded.listen()
inthestate.dart
, database calls work as they should. This is evidenced by the calls I make to directdb inside ofDogApp.widget
.However, when I run this exact same code in ios, there is no hang. FYI, i've done a simpler test (At bottom) and it does not break in the same way that the main example does, so somewhere in Flutter UI's relationship with the DB there is a bug.
Github Code
https://github.com/hunterpp/testdb
Good Output
This is print output when
.onChildAdded.listen()
is commented out on web, or run in iOS uncommented. As you can see, COMPLETE dog 2 is shown, which means that thedirectdb
call inDogApp.widget
is getting data back from the databaseBad Output
When
.onChildAdded.listen()
is called in web the dog 1 and dog 2 do not execute COMPLETE. Heremain.dart
thestate.dart
directdb.dart
Simple Test (Works)