diff --git a/packages/stream_chat/lib/src/client.dart b/packages/stream_chat/lib/src/client.dart index 5117f7da..a6ec79d7 100644 --- a/packages/stream_chat/lib/src/client.dart +++ b/packages/stream_chat/lib/src/client.dart @@ -403,11 +403,11 @@ class StreamChatClient { /// Set the current user, this triggers a connection to the API. /// It returns a [Future] that resolves when the connection is setup. @Deprecated('Use `connectUser` instead. Will be removed in Future releases') - Future setUser(User user, String token) => connectUser(user, token); + Future setUser(User user, String token) => connectUser(user, token); /// Connects the current user, this triggers a connection to the API. /// It returns a [Future] that resolves when the connection is setup. - Future connectUser(User? user, String? token) async { + Future connectUser(User? user, String? token) async { if (_connectCompleter != null && !_connectCompleter!.isCompleted) { logger.warning('Already connecting'); throw Exception('Already connecting'); @@ -442,11 +442,12 @@ class StreamChatClient { @Deprecated( 'Use `connectUserWithProvider` instead. Will be removed in Future releases', ) - Future setUserWithProvider(User user) => connectUserWithProvider(user); + Future setUserWithProvider(User user) => + connectUserWithProvider(user); /// Connects the current user using the [tokenProvider] to fetch the token. /// It returns a [Future] that resolves when the connection is setup. - Future connectUserWithProvider(User user) async { + Future connectUserWithProvider(User user) async { if (tokenProvider == null) { throw Exception(''' TokenProvider must be provided in the constructor in order to use `connectUserWithProvider` method. @@ -500,7 +501,7 @@ class StreamChatClient { Completer? _connectCompleter; /// Connect the client websocket - Future connect() async { + Future connect() async { logger.info('connecting'); if (wsConnectionStatus == ConnectionStatus.connecting) { logger.warning('Already connecting'); @@ -570,7 +571,7 @@ class StreamChatClient { _connectionStatusSubscription = _ws.connectionStatusStream.listen(_connectionStatusHandler); - var event = (await _chatPersistenceClient?.getConnectionInfo())!; + var event = await _chatPersistenceClient?.getConnectionInfo(); await _ws.connect()!.then((e) async { await _chatPersistenceClient?.updateConnectionInfo(e); @@ -589,7 +590,7 @@ class StreamChatClient { /// Get the events missed while offline to sync the offline storage Future resync([List? cids]) async { - final lastSyncAt = (await _chatPersistenceClient?.getLastSyncAt())!; + final lastSyncAt = await _chatPersistenceClient?.getLastSyncAt(); if (lastSyncAt == null) { _synced = true; @@ -943,12 +944,12 @@ class StreamChatClient { /// the API. It returns a [Future] that resolves when the connection is setup. @Deprecated( 'Use `connectAnonymousUser` instead. Will be removed in Future releases') - Future setAnonymousUser() => connectAnonymousUser(); + Future setAnonymousUser() => connectAnonymousUser(); /// Connects the current user with an anonymous id, this triggers a connection /// to the API. It returns a [Future] that resolves when the connection is /// setup. - Future connectAnonymousUser() async { + Future connectAnonymousUser() async { if (_connectCompleter != null && !_connectCompleter!.isCompleted) { logger.warning('Already connecting'); throw Exception('Already connecting'); @@ -973,11 +974,11 @@ class StreamChatClient { /// It returns a [Future] that resolves when the connection is setup. @Deprecated( 'Use `connectGuestUser` instead. Will be removed in Future releases') - Future setGuestUser(User user) => connectGuestUser(user); + Future setGuestUser(User user) => connectGuestUser(user); /// Connects the current user as guest, this triggers a connection to the API. /// It returns a [Future] that resolves when the connection is setup. - Future connectGuestUser(User user) async { + Future connectGuestUser(User user) async { _anonymous = true; final response = await post('/guest', data: {'user': user.toJson()}) .then((res) => decode(