addGroupMembers method

Future addGroupMembers(
  1. List<AtContact?> contacts,
  2. AtGroup group
)

Function to add members to a group

Implementation

Future<dynamic> addGroupMembers(List<AtContact?> contacts, AtGroup group) async {
  for (var i = 0; i < contacts.length; i++) {
    if (contacts[i]!.tags != null && contacts[i]!.tags!['image'] != null) {
      contacts[i]!.tags!['image'] = null;
    }
  }

  try {
    var result = await atContactImpl.addMembers(Set.from(contacts), group);
    await updateGroupStreams(group, expandGroup: true);
    return result;
  } catch (e) {
    atSignLogger.severe('error in adding members: $e');
    return e;
  }
}