setGroupAdmins method
void
setGroupAdmins(})
Adds some existing group members to the group admins, and/or removes admin status from some existing group admins. Can only be done by a group administrator.
groupId
- The group for which to set admins.
addToAdmins
- The Seald IDs of existing group members to add as group admins.
removeFromAdmins
- The Seald IDs of existing group members to remove from group admins.
Implementation
void setGroupAdmins(String groupId,
{List<String> addToAdmins = const [],
List<String> removeFromAdmins = const []}) {
if (_closed) {
throw SealdException(
code: "INSTANCE_CLOSED",
id: "FLUTTER_INSTANCE_CLOSED",
description: "Instance already closed.");
}
final Pointer<Utf8> nativeGroupId = groupId.toNativeUtf8();
final Pointer<NativeSealdStringArray> nativeAddToAdmins =
_sealdStringArrayFromList(addToAdmins);
final Pointer<NativeSealdStringArray> nativeRemoveFromAdmins =
_sealdStringArrayFromList(removeFromAdmins);
final Pointer<Pointer<NativeSealdError>> err =
calloc<Pointer<NativeSealdError>>();
final int resultCode = _bindings.SealdSdk_SetGroupAdmins(_ptr.pointer(),
nativeGroupId, nativeAddToAdmins, nativeRemoveFromAdmins, err);
calloc.free(nativeGroupId);
_bindings.SealdStringArray_Free(nativeAddToAdmins);
_bindings.SealdStringArray_Free(nativeRemoveFromAdmins);
if (resultCode != 0) {
throw SealdException._fromCPtr(err);
} else {
calloc.free(err);
}
}