Skip to content
Discussion options

You must be logged in to vote

I figured this out. So the problem lies here:

  StreamSubscription<Item> _startListening() {
    setState(() {
      streamedWidgets.clear();
    });

I called the clear method, but the clear method won't necessarily recreate a new array, and the reference to the object is kept by the runtime. Flutter refreshes the UI based on the change of references. Therefore, even though the data has changed, the UI won't get updated...

The solution is to replace the original method calling with

streamedWidgets = []; 

This way, it will create a new array and therefore a new reference to trigger the UI update.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AspadaX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant