diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index e4d7bccbde..887bcee2cf 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -390,7 +390,7 @@ class MatrixState extends State LoginState state, Client currentClient, ) async { - _cancelSubs(currentClient.clientName); + await _cancelSubs(currentClient.clientName); widget.clients.remove(currentClient); ClientManager.removeClientNameFromStore(currentClient.clientName); TwakeSnackBar.show( @@ -466,14 +466,14 @@ class MatrixState extends State } } - void _cancelSubs(String name) { - onRoomKeyRequestSub[name]?.cancel(); + Future _cancelSubs(String name) async { + await onRoomKeyRequestSub[name]?.cancel(); onRoomKeyRequestSub.remove(name); - onKeyVerificationRequestSub[name]?.cancel(); + await onKeyVerificationRequestSub[name]?.cancel(); onKeyVerificationRequestSub.remove(name); - onLoginStateChanged[name]?.cancel(); + await onLoginStateChanged[name]?.cancel(); onLoginStateChanged.remove(name); - onNotification[name]?.cancel(); + await onNotification[name]?.cancel(); onNotification.remove(name); }