declineInvitation method

Future<void> declineInvitation({
  1. required String groupId,
  2. required String inviter,
  3. String? reason,
})

~english Declines a group invitation.

Param groupId The group ID.

Param inviter The username of the inviter.

Param reason The reason of declining.

Throws A description of the exception. See ChatError. ~end

~chinese 拒绝入群邀请。

Param groupId 群组 ID。

Param inviter 邀请者的用户 ID。

Param reason 拒绝理由。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError。 ~end

Implementation

Future<void> declineInvitation({
  required String groupId,
  required String inviter,
  String? reason,
}) async {
  Map req = {'groupId': groupId, 'inviter': inviter};
  req.putIfNotNull('reason', reason);
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.declineInvitationFromGroup, req);
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}