deleteRobot method

Future<NIMResult<void>> deleteRobot(
  1. String accid
)

Deletes a robot and removes it from the local cache after success.

Implementation

Future<NIMResult<void>> deleteRobot(String accid) async {
  final accountId = _accountProvider();
  if (accid.isEmpty || !_isCurrentAccount(accountId)) {
    return NIMResult.failure(message: 'invalid accid');
  }
  final result = await NimCore.instance.aiService.deleteUserAIBot(
    V2NIMDeleteUserAIBotParams(accid: accid),
  );
  if (result.isSuccess && _isCurrentAccount(accountId)) {
    _robotCache.remove(accid);
    _notifyRobotsChanged();
  }
  return result;
}