skip to Main Content

Firebase – How to run async function once in streambuilder

I have a streambuilder that Im trying to call a function that updates the read status on my app void readMessage() async { int num = 0; final query = await FirebaseFirestore.instance .collection('chats') .doc(chatroomId(FirebaseAuth.instance.currentUser!.uid, widget.uid)) .collection('messages') .where('uid', isEqualTo: widget.uid) .where('read',…

VIEW QUESTION

FCM FirebaseMessaging.onMessageOpenedApp Won't work

Although all the other functions work perfectly, I receive the message and display it in all conditions, in the background, foreground or initial message. in the background: Future<void> backgroundHandler(RemoteMessage message) async { print(message.data.toString()); print(message.notification!.title); } FirebaseMessaging.onBackgroundMessage(backgroundHandler); in the foreground: FirebaseMessaging.onMessage.listen((message)…

VIEW QUESTION
Back To Top
Search