inviterUser method
Invites users to join the group.
This method works only for groups with the style of ChatGroupStyle.PrivateOnlyOwnerInvite, ChatGroupStyle.PrivateMemberCanInvite, or ChatGroupStyle.PublicJoinNeedApproval. For a group with the ChatGroupStyle.PrivateOnlyOwnerInvite style, only the group owner can invite users to join the group; For a group with the ChatGroupStyle.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 ChatError.
Implementation
Future<void> inviterUser(
String groupId,
List<String> members, {
String? reason,
}) async {
Map req = {
'groupId': groupId,
'members': members,
};
req.putIfNotNull("reason", reason);
Map result = await _channel.invokeMethod(
ChatMethodKeys.inviterUser,
req,
);
try {
ChatError.hasErrorFromResult(result);
} on ChatError catch (e) {
throw e;
}
}