check whether persistent client is connected

This commit is contained in:
kanat
2023-05-18 10:58:18 -07:00
parent b6ee41f699
commit 4c47145ba5
2 changed files with 6 additions and 0 deletions
@@ -14,6 +14,9 @@ import 'package:stream_chat/src/core/util/extension.dart';
/// A simple client used for persisting chat data locally.
abstract class ChatPersistenceClient {
/// Whether the connection is established.
bool get isConnected;
/// Creates a new connection to the client
Future<void> connect(String userId);
@@ -79,6 +79,9 @@ class StreamChatPersistenceClient extends ChatPersistenceClient {
webUseIndexedDbIfSupported: _webUseIndexedDbIfSupported,
);
@override
bool get isConnected => db != null;
@override
Future<void> connect(
String userId, {