File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
packages/stream_feeds/lib/src
sample_app/lib/navigation Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class FeedsClient {
2626 apiKey: apiKey,
2727 user: user,
2828 getToken: () async => userToken,
29- getConnectionId: () => webSocketClient? .connectionId,
29+ getConnectionId: () => webSocketClient.connectionId,
3030 ),
3131 ),
3232 );
@@ -72,8 +72,8 @@ class FeedsClient {
7272 Future <void > connect () async {
7373 webSocketClient.connect ();
7474
75- _connectionSubscription = webSocketClient ! .connectionStateStream
76- .listen (_onConnectionStateChanged);
75+ _connectionSubscription =
76+ webSocketClient.connectionStateStream .listen (_onConnectionStateChanged);
7777
7878 connectionRecoveryHandler = DefaultConnectionRecoveryHandler (
7979 client: webSocketClient,
@@ -94,6 +94,13 @@ class FeedsClient {
9494 _connectionCompleter = null ;
9595 }
9696
97+ void dispose () {
98+ if (webSocketClient.connectionState is Connected ) {
99+ disconnect ();
100+ }
101+ webSocketClient.dispose ();
102+ }
103+
97104 void _onConnectionStateChanged (WebSocketConnectionState state) {
98105 if (_connectionCompleter != null ) {
99106 if (state is Connected ) {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class AppStateProvider extends ValueNotifier<AppState> {
4848 void clearUserId () {
4949 _prefs.remove ('user_id' );
5050 if (value is LoggedInState ) {
51- (value as LoggedInState ).feedsClient.disconnect ();
51+ (value as LoggedInState ).feedsClient.dispose ();
5252 }
5353 value = LoggedOutState ();
5454 }
You can’t perform that action at this time.
0 commit comments