Dynamic new chat messages indication with FF 1:1 chat

Database & APIs

Hi, does anybody know how to have a dynamic chat notification indicator in flutterflow using its 1:1 chat template?

As there's no direct way to find how many unread chat msgs are there, the best I could find is to count how many chats the active user has, how many chats the active user appears in the last_message_seen_by array, and compare these two numbers. If they don't match it means there are unread messages.

I implemented this logic in the navbar component (custom) using on initialization actions.

It works well when the user opens/refreshes the page or navigates to another page. However I cannot find a way to make it dynamic, meaning that the indication will show (as a Badge condition) when there's a new incoming chat message without the user doing anything.

I tried with nested firebase queries but it did not trigger the badge automatically.

Any help on that is appreciated. Thanks

What have you tried so far?

Using firebase queries in parent widgets. did not trigger the indication

Did you check FlutterFlow's Documentation for this topic?
Yes
1
2 replies