Relative Content

Tag Archive for androidflutterdartflutter-dependencies

my problem is there are handle chats for multiple users uding Firebase and each user must be get own chat

import ‘package:cloud_firestore/cloud_firestore.dart’; Future<List<Map<String, dynamic>>> getMessages() async { try { QuerySnapshot<Map<String, dynamic>> querySnapshot; if (userType == ‘donor’) { querySnapshot = await FirebaseFirestore.instance .collection(‘messages’) .where(‘sender_id’, isEqualTo: localid) .where(‘receiver_id’, isEqualTo: global_id) .orderBy(‘time’, descending: true) .get(); } else if (userType == ‘taker’) { querySnapshot = await FirebaseFirestore.instance .collection(‘messages’) .where(‘receiver_id’, isEqualTo: localid) .where(‘sender_id’, isEqualTo: taker_id) .orderBy(‘time’, descending: true) .get(); } […]