getAllGroupsDetails method

dynamic getAllGroupsDetails()

Implementation

getAllGroupsDetails() async {
  try {
    var groupIds = await atContactImpl.listGroupIds();
    var groupList = <AtGroup>[];

    for (var i = 0; i < groupIds.length; i++) {
      var groupDetail = await (getGroupDetail(groupIds[i]!));
      // ignore: unnecessary_null_comparison
      if (groupDetail != null) groupList.add(groupDetail);
    }

    groupList.forEach((AtGroup group) {
      allContacts.add(
          GroupContactsModel(group: group, contactType: ContactsType.GROUP));
    });
    atGroupSink.add(groupList);
  } catch (e) {
    print('error in getting group list: $e');
  }
}