kickDevice method

Future<void> kickDevice(
  1. {required String userId,
  2. required String pwdOrToken,
  3. required String resource,
  4. bool isPwd = true}
)

Forces the specified account to log out from the specified device.

Param userId The account you want to force to log out.

Param pwdOrToken The password or token.

Param resource The device ID. For how to fetch the device ID, See ChatDeviceInfo.resource.

Throws A description of the exception. See ChatError.

Implementation

Future<void> kickDevice({
  required String userId,
  required String pwdOrToken,
  required String resource,
  bool isPwd = true,
}) async {
  EMLog.v('kickDevice: $userId, "******"');
  Map req = {
    'username': userId,
    'password': pwdOrToken,
    'resource': resource,
    'isPwd': isPwd,
  };
  Map result =
      await ClientChannel.invokeMethod(ChatMethodKeys.kickDevice, req);
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}