addMembers method

Future<void> addMembers(
  1. String groupId,
  2. List<String> members,
  3. {String? welcome}
)

Adds users to the group.

Only the group owner or admin can call this method.

Param groupId The group ID.

Param members The array of new members to add.

Param welcome The welcome message.

Throws A description of the exception. See ChatError.

Implementation

Future<void> addMembers(
  String groupId,
  List<String> members, {
  String? welcome,
}) async {
  Map req = {'groupId': groupId, 'members': members};
  req.putIfNotNull("welcome", welcome);
  Map result = await _channel.invokeMethod(ChatMethodKeys.addMembers, req);
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}