inviterUser method Null safety
Invites users to join the group.
This method works only for groups with the style of PrivateOnlyOwnerInvite
, PrivateMemberCanInvite
, or PublicJoinNeedApproval
.
For a group with the PrivateOnlyOwnerInvite style, only the group owner can invite users to join the group;
For a group with the PrivateMemberCanInvite style, each group member can invite users to join the group.
Param groupId
The group ID.
Param members
The array of new members to invite.
Param reason
The invitation reason.
Throws A description of the exception. See {@link EMError}.
Implementation
Future<void> inviterUser(
String groupId,
List<String> members, {
String? reason,
}) async {
Map req = {
'groupId': groupId,
'members': members,
};
req.setValueWithOutNull("reason", reason);
Map result = await _channel.invokeMethod(
ChatMethodKeys.inviterUser,
req,
);
try {
EMError.hasErrorFromResult(result);
} on EMError catch (e) {
throw e;
}
}