changeAppKey method

Future<bool> changeAppKey(
  1. {required String newAppKey}

Updates the App Key, which is the unique identifier to access Agora Chat.

You can retrieve the new App Key from Agora Console.

As this key controls all access to Agora Chat for your app, you can only update the key when the current user is logged out.

Param newAppKey The App Key. Ensure that you set this parameter.

Throws A description of the exception. See ChatError.


Future<bool> changeAppKey({required String newAppKey}) async {
  EMLog.v('changeAppKey: $newAppKey');
  Map req = {'appKey': newAppKey};
  Map result =
      await ClientChannel.invokeMethod(ChatMethodKeys.changeAppKey, req);
  try {
    return result.boolValue(ChatMethodKeys.changeAppKey);
  } on ChatError catch (e) {
    throw e;