ChatClient class
The ChatClient class, which is the entry point of the Chat SDK. With this class, you can log in, log out, and access other functionalities such as group and chatroom.
Properties
- chatManager → ChatManager
-
Gets the ChatManager class. Make sure to call it after ChatClient has been initialized.
read-only
- chatRoomManager → ChatRoomManager
-
Gets the ChatRoomManager class. Make sure to call it after the ChatClient has been initialized.
read-only
- chatThreadManager → ChatThreadManager
-
Gets the ChatThreadManager class. Make sure to call it after the ChatClient has been initialized.
read-only
- contactManager → ChatContactManager
-
Gets the ChatContactManager class. Make sure to call it after the ChatClient has been initialized.
read-only
- currentUserId → String?
-
Gets the current logged-in user ID.
read-only
- customEventHandler ↔ (void Function(Map map)?)
-
Sets a custom event handler to receive data from iOS or Android devices.
read / write
- groupManager → ChatGroupManager
-
Gets the ChatGroupManager class. Make sure to call it after the ChatClient has been initialized.
read-only
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- options → ChatOptions?
-
Gets the configurations.
read-only
- presenceManager → ChatPresenceManager
-
Gets the ChatPresenceManager class. Make sure to call it after the ChatClient has been initialized.
read-only
- pushManager → ChatPushManager
-
Gets the ChatPushManager class. Make sure to call it after the ChatClient has been initialized.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- userInfoManager → ChatUserInfoManager
-
Gets the ChatUserInfoManager class. Make sure to call it after the ChatClient has been initialized.
read-only
Methods
-
addConnectionEventHandler(
String identifier, ConnectionEventHandler handler) → void - Adds the connection event handler. After calling this method, you can handle new connection events when they arrive.
-
addMultiDeviceEventHandler(
String identifier, ChatMultiDeviceEventHandler handler) → void - Adds the multi-device event handler. After calling this method, you can handle for new multi-device events when they arrive.
-
changeAppKey(
{required String newAppKey}) → Future< bool> - Updates the App Key, which is the unique identifier to access Agora Chat.
-
clearConnectionEventHandles(
) → void - Clears all connection event handlers.
-
clearMultiDeviceEventHandles(
) → void - Clears all multi-device event handlers.
-
compressLogs(
) → Future< String> - Compresses the debug log into a gzip archive.
-
createAccount(
String userId, String password) → Future< void> - Registers a new user.
-
fetchLoggedInDevices(
{required String userId, required String pwdOrToken, bool isPwd = true}) → Future< List< ChatDeviceInfo> > - Gets the list of currently logged-in devices of a specified account.
-
getAccessToken(
) → Future< String> - Gets the token of the current logged-in user.
-
getConnectionEventHandler(
String identifier) → ConnectionEventHandler? - Gets the connection event handler.
-
getCurrentUserId(
) → Future< String?> - Gets the current login user ID.
-
getLoggedInDevicesFromServer(
{required String userId, required String password}) → Future< List< ChatDeviceInfo> > - Gets the list of currently logged-in devices of a specified account.
-
getMultiDeviceEventHandler(
String identifier) → ChatMultiDeviceEventHandler? - Gets the multi-device event handler.
-
init(
ChatOptions options) → Future< void> - Initializes the SDK.
-
isConnected(
) → Future< bool> - Checks whether the SDK is connected to the chat server.
-
isLoginBefore(
) → Future< bool> - Checks whether the user has logged in before and did not log out.
-
kickAllDevices(
{required String userId, required String pwdOrToken, bool isPwd = true}) → Future< void> - Forces the specified account to log out from all devices.
-
kickDevice(
{required String userId, required String pwdOrToken, required String resource, bool isPwd = true}) → Future< void> - Forces the specified account to log out from the specified device.
-
login(
String userId, String pwdOrToken, [bool isPassword = true]) → Future< void> - Logs in to the chat server with a password or token.
-
loginWithAgoraToken(
String userId, String agoraToken) → Future< void> - Logs in to the chat server by user ID and Agora token. This method supports automatic login.
-
logout(
[bool unbindDeviceToken = true]) → Future< void> - Logs out.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeConnectionEventHandler(
String identifier) → void - Removes the connection event handler.
-
removeMultiDeviceEventHandler(
String identifier) → void - Removes the multi-device event handler.
-
renewAgoraToken(
String agoraToken) → Future< void> - Renews the Agora token.
-
startCallback(
) → Future< void> - Starts contact and group, chatroom callback.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- getInstance → ChatClient
-
Gets the SDK instance.
read-only