changeAppId method

Future<bool> changeAppId({
  1. required String newAppId,
})

Updates the App Id, 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 newAppId The App Id. Ensure that you set this parameter.

Throws A description of the exception. See ChatError.

Implementation

Future<bool> changeAppId({required String newAppId}) async {
  try {
    ChatLog.v('newAppId: $newAppId');
    Map req = {'appId': newAppId};
    Map result = await platform_interface.Client.instance
        .callNativeMethod(ChatMethodKeys.changeAppId, req);
    ChatError.hasErrorFromResult(result);
    return result.boolValue(ChatMethodKeys.changeAppKey);
  } catch (e) {
    rethrow;
  }
}