I have the following related models. I want to filter a coversation by at least 2 participants ids.
import 'package:realm/realm.dart';
part 'conversation.g.dart';
@RealmModel()
class _Conversation {
@PrimaryKey()
late int id;
late int createdById;
late String createdByAuthId;
late String? createdByName;
late String createdByUsername;
late String type; //private,group
late String? title;
late String? description;
late bool isArchived;
late DateTime lastActivity;
late DateTime createdAt;
late List<_Participant> participants;
late List<_Message> messages;
}
@RealmModel()
class _Participant {
@PrimaryKey()
late int id;
late int userId;
late String userAuthId;
late String username;
late String? name;
late String? avatarUrl;
late DateTime joinedAt;
late String role;
late DateTime createdAt;
@Backlink(#participants)
late Iterable<_Conversation> linkedConversation;
late List<_Message> messages;
}
@RealmModel()
class _Message {
@PrimaryKey()
late int id;
late String content;
bool isRead = false;
late DateTime createdAt;
late int? parentMessageId;
late int readCount;
@Backlink(#messages)
late Iterable<_Participant> linkedParticipant;
@Backlink(#messages)
late Iterable<_Conversation> linkedConversation;
}