Open
Description
Describe the bug
I have one table(chats) which has id auto generated when any items added. other table(chat_members) connected with this table's id field(foreign key pairs). when i listen this chats table, with following code:
final currentUserId = supabase.auth.currentUser?.id;
final memberSubquery = await supabase
.from('chat_members')
.select('chat_id')
.eq('user_id', currentUserId ?? '');
final List<dynamic> currentUserChatIds =
memberSubquery.map((e) => e.values.firstOrNull ?? '').toList() ?? [];
final messageStream = supabase
.from('chats')
.stream(primaryKey: ['id']).inFilter('id', chatIds as List<String>);
await emit.forEach(messageStream, onData: (data) {
final chats = data.map((e) => ChatMd.fromMap(e)).toList();
return ChatsLoaded(chats);
});
it is not giving chats, where its id contains currentUserChatIds.
Expected behavior
i want to filter chats where its id are in current user's chats id list.
Screenshots
Here is chat table
Here is chat member table, where members added when user click on join button
Additional context
flutter version:
Framework • revision 41456452f2 (6 weeks ago) • 2024-01-25 10:06:23 -0800
Engine • revision f40e976bed
Tools • Dart 3.2.6 • DevTools 2.28.5```
supabase version:
supabase_flutter: ^2.3.4