Bad state: Stream has already been listened to.
Opened this issue · 0 comments
Describe the bug
Bad state: Stream has already been listened to.
The following StateError was thrown building AnimatedBuilder(listenable: AnimationController#e3f05(⏮ 0.000; paused), state: _AnimatedState#fa90d):
To Reproduce
Steps to reproduce the behavior:
I have a contact list, so initiate a control list:
void initChatControllers(int contactCounts){
int count = 0;
while(count < contactCounts) {
controllers.add(ChatController(
initialMessageList: Data.messageList,
scrollController: ScrollController(),
currentUser: ChatUser(
id: '1',
name: 'YSM',
profilePhoto: Data.profileImage,
),
otherUsers: [
ChatUser(
id: '2',
name: 'Simform',
profilePhoto: Data.profileImage,
),
]
));
count++;
}
update();
}
When I click one contact, I need to switch to another controller:
void updateFromUser(String user, int idx){
contact = user;
this.index = idx;
updateTopics();
chatController = controllers[idx];
update();
}
**There is no error when I switch to new controller. The error occurs when I switch to old one.
I also searched via google, a suggestion is to use broadcast. I expect to resolved inside this plugin.
Thanks!**