removeGroupMembers method
void
removeGroupMembers(
- String groupId, {
- required List<
String> membersToRemove, - SealdGeneratedPrivateKeys? privateKeys,
Removes members from the group. Can only be done by a group administrator. You should call renewGroupKey after this.
groupId
- The group from which to remove members.
membersToRemove
- The Seald IDs of the members to remove from the group.
privateKeys
- Optional. Pre-generated private keys, returned by a call to SealdSdk.generatePrivateKeysAsync.
Implementation
void removeGroupMembers(String groupId,
{required List<String> membersToRemove,
SealdGeneratedPrivateKeys? privateKeys}) {
if (_closed) {
throw SealdException(
code: "INSTANCE_CLOSED",
id: "FLUTTER_INSTANCE_CLOSED",
description: "Instance already closed.");
}
if (_shouldRenewGroup(groupId)) {
renewGroupKey(groupId, privateKeys: privateKeys);
}
final Pointer<Utf8> nativeGroupId = groupId.toNativeUtf8();
final Pointer<NativeSealdStringArray> nativeMembersToRemove =
_sealdStringArrayFromList(membersToRemove);
final Pointer<Pointer<NativeSealdError>> err =
calloc<Pointer<NativeSealdError>>();
final int resultCode = _bindings.SealdSdk_RemoveGroupMembers(
_ptr.pointer(), nativeGroupId, nativeMembersToRemove, err);
calloc.free(nativeGroupId);
_bindings.SealdStringArray_Free(nativeMembersToRemove);
if (resultCode != 0) {
throw SealdException._fromCPtr(err);
} else {
calloc.free(err);
}
}