filteredChatsProvider top-level property

dynamic filteredChatsProvider
final

Implementation

final filteredChatsProvider =
    FutureProvider.autoDispose<List<String>>((ref) async {
  final allRooms = ref.watch(chatIdsProvider);
  if (!ref.watch(hasRoomFilters)) {
    throw 'No filters selected';
  }

  final foundRooms = List<String>.empty(growable: true);

  final search = ref.watch(roomListFilterProvider);
  for (final convoId in allRooms) {
    if (await roomListFilterStateAppliesToRoom(search, ref, convoId)) {
      foundRooms.add(convoId);
    }
  }

  return foundRooms;
});