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
MessagesListController not able to clear items when enter chatPage again from another chatid #21
Comments
First off, I'm not sure I understand your flow. Usually to leave a ChatScreen, the user will go BACK and therefore pop the destination from the stack to return to ChatsScreen (the list of Chats), therefore also disposing the controller. When you call |
@themadmrj I am currently found, even I re-enter same chatid page, the msg still increase, rather than first clear and then add only 25 msgs. And my observation is that seems the stream call twice..... But I don't know why it called twice... I am gonna to cry about this. Here is my code of navigate to detail:
|
Good old debugging process, just add |
I solved my problem, thanks! |
For future people might got this issue... I dont' plan to tell u guys.. |
Here is my code:
this is inside my
initState
function, so I want clear items every time enter a new chatPage. But it doesn't do this.Normally, first log should be 0, and every time
crtChatMsgs
only fetechs 25 msgs from local. So everytime it enters chatPage, it should be 25 msgs.However, first time:
this is normal, then I switch to another chatid (another chat page):
As u can see, second time the msg doesn't clear at all. It becomes 50, double of them. Normally, it should be fresh 25 msgs.
And the UI actually doesn't updated still contains data from previous chatid.
What could be the reason?
(I am new to flutter maybe I did something wrong but this lib is really useful, so I use it)
The text was updated successfully, but these errors were encountered: