Skip to content

Commit

Permalink
Filter null from futures before disposing
Browse files Browse the repository at this point in the history
  • Loading branch information
phuchuynhStrong committed Nov 30, 2020
1 parent d51576f commit 6adf61f
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,12 @@ class SocketClient {
Future<void> dispose() async {
print('Disposing socket client..');
_reconnectTimer?.cancel();
final closing = [
await Future.wait([
socket?.close(),
_messageSubscription?.cancel(),
_connectionStateController?.close(),
];
if (_keepAliveSubscription != null) {
closing.add(_keepAliveSubscription?.cancel());
}
await Future.wait(closing);
_keepAliveSubscription?.cancel()
].where((future) => future != null).toList());
}

static GraphQLSocketMessage _parseSocketMessage(dynamic message) {
Expand Down

0 comments on commit 6adf61f

Please sign in to comment.