typingStatusStream method

Stream<bool> typingStatusStream(
  1. String senderId,
  2. String receiverId
)

Get the typing status of the other user in a chat Returns a stream that emits true if the other user is typing, false otherwise.

Implementation

Stream<bool> typingStatusStream(String senderId, String receiverId) {
  final chatId = getChatId(senderId, receiverId);
  return _firestore
      .collection('chats')
      .doc(chatId)
      .snapshots()
      .map((snapshot) {
    final data = snapshot.data();
    if (data == null || data['typingStatus'] == null) return false;
    return data['typingStatus'][receiverId] ?? false;
  });
}