Skip to content

Commit

Permalink
krille-chan#75 FluffyChat: added if(mounted) to avoid setState error
Browse files Browse the repository at this point in the history
  • Loading branch information
carowebtec committed Mar 6, 2023
1 parent cd1aff4 commit ab83408
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/pages/chat_list/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,19 @@ class ChatListController extends State<ChatList>

_checkTorBrowser();

Matrix.of(context).client.loadReadReceiptRequests(
(bool hasToGiveReadReceipt) =>
setState(() => this.hasToGiveReadReceipt = hasToGiveReadReceipt));
Matrix.of(context)
.client
.loadReadReceiptRequests(_updateHasToGiveReadReceipt);

super.initState();
}

void _updateHasToGiveReadReceipt(bool hasToGiveReadReceipt) {
if (mounted) {
setState(() => this.hasToGiveReadReceipt = hasToGiveReadReceipt);
}
}

@override
void dispose() {
_intentDataStreamSubscription?.cancel();
Expand Down

0 comments on commit ab83408

Please sign in to comment.