One more thing: I'm trying realtime updates and it...
# flutter
i
One more thing: I'm trying realtime updates and it's not working for me: 1. Created table and enabled realtime and RLS for it (including default rule for select if true) 2. Using anon access 3. This is the code that does initial fetch and is not triggered again if I update any data from the console
Copy code
db.from('projects').stream(['id', 'title', 'votes']).execute().map((list) {
      return list
          .map((columns) => Project.fromJson(columns))
          .toList();
    });
here is another one that is not triggered either
Copy code
db.from('projects').on(SupabaseEventTypes.all, (payload) {
      print("update");
      print(payload);
    }).subscribe();
Should it work or am I missing anything? Or it's not triggered at all if I make updates from the console (admin web app)?
m
I didn't see a
.listen(something)
in the first one. You can also run this example and compare it with how you are using: https://github.com/supabase-community/flutter-chat/ This file here makes realtime calls: https://github.com/supabase-community/flutter-chat/blob/6f5b03f44313b7ca355cf9b353a8ecf39f872a51/lib/cubits/rooms/rooms_cubit.dart
Just moved from the channel to here to keep it threaded.
Illia (2022-06-02) - p2
i
nice, I had other issue - but your example helped - thanks a lot!
m
You are welcome, @Illia 🙂
2 Views