isConnected method

Future<bool> isConnected()

Checks whether the SDK is connected to the chat server.

Return Whether the SDK is connected to the chat server. true: The SDK is connected to the chat server. false: The SDK is not connected to the chat server.

Implementation

Future<bool> isConnected() async {
  try {
    Map result = await platform_interface.Client.instance.callNativeMethod(
      ChatMethodKeys.isConnected,
    );
    ChatError.hasErrorFromResult(result);
    return result.boolValue(ChatMethodKeys.isConnected);
  } catch (e) {
    rethrow;
  }
}