changeAppKey method

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

修改 App Key。

@note 只有在未登录状态才能修改 App Key。

Param newAppKey App Key,请确保设置该参数。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError

Implementation

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