FyreChat class
Properties
firebaseUser
↔ User?
Current logged-in user. Update is handled internally.
getter/setter pair
getFirebaseFirestore
→ FirebaseFirestore
Getter for FirebaseFirestore singleton
no setter
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
createGroupRoom ({Role creatorRole = mm.Role.admin , String ? imageUrl , Map <String , dynamic > ? metadata , required String name , required List <User > users })
→ Future <Room >
create room
createRoom (User otherUser , {Map <String , dynamic > ? metadata })
→ Future <Room >
Creates a direct chat for 2 people. Add metadata for any additional
custom data.
createUserInFirestore (User user )
→ Future <void >
Creates mm.User in Firebase to store name and avatar used on
rooms list.
deleteMessage (String roomId , String messageId )
→ Future <void >
Removes message document.
deleteRoom (String roomId )
→ Future <void >
Removes room document.
deleteUserFromFirestore (String userId )
→ Future <void >
Removes mm.User from users collection in Firebase.
editTextMessage ({required String roomId , required String messageId , required String newText })
→ Future <void >
Edits an existing text message and marks it as edited in metadata
getLastMessage (String roomId )
→ Future <String ? >
Fetches the custom lastMsg field for a specific room by its ID.
getMessageCount (String roomId )
→ Future <int >
getMessagesFuture (Room room , {List <Object ? > ? endAt , List <Object ? > ? endBefore , int ? limit , List <Object ? > ? startAfter , List <Object ? > ? startAt })
→ Future <List <Message > >
Returns messages from a room as a Future with the same parameters as the messages stream
getOtherReaction ({required String roomId , required String messageId , required String otherUserId })
→ Future <String ? >
getRoomById (String roomId )
→ Future <Room ? >
Gets room data by room ID
Returns Future<mm.Room?> - The room if found, null otherwise
getUserById (String id )
→ Future <User ? >
getUserByIdStream (String id )
→ Stream <User ? >
hasUserSeenMessage (String roomId , String messageId )
→ Future <bool >
Checks if the user has seen a message.
lastMessageStream (String roomId )
→ Stream <Message ? >
Returns a stream of the last message in a room, checking if it's deleted
markMessageAsSeen (String roomId , String messageId )
→ Future <void >
Marks a message as seen if not already.
Updates Firestore with the user's ID and timestamp.
messages (Room room , {List <Object ? > ? endAt , List <Object ? > ? endBefore , int ? limit , List <Object ? > ? startAfter , List <Object ? > ? startAt })
→ Stream <List <Message > >
Returns a stream of messages from Firebase for a given room.
/// Returns a stream of messages from Firebase for a given room.
Now with enhanced reply support.
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reactToMessage ({required String roomId , required String messageId , required String emoji })
→ Future <void >
room (String roomId )
→ Stream <Room >
Returns a stream of changes in a room from Firebase.
roomList ({bool orderByUpdatedAt = false })
→ Future <List <Room > >
rooms ({bool orderByUpdatedAt = false })
→ Stream <List <Room > >
get rooms data list
roomStreamList ({bool orderByUpdatedAt = false })
→ Stream <List <Room > >
searchUsersByFullName (String query )
→ Future <List <User > >
sendMessage (dynamic partialMessage , String roomId )
→ void
Sends a message to the Firestore. Accepts any partial message and a
room ID. If arbitraty data is provided in the partialMessage
does nothing.
sendMessageReply (Message partialMessage , String roomId )
→ void
sendReply ({required Message originalMessage , required dynamic partialReply , required String roomId })
→ Future <void >
Sends a reply to a message in the Firestore.
Accepts the original message being replied to, the partial reply message,
and the room ID.
setDeleteMessage ({required String roomId , required String messageId })
→ Future <void >
Edits an existing text message and marks it as edited in metadata
setOnline (bool online )
→ void
toString ()
→ String
A string representation of this object.
inherited
updateMessage (Message message , String roomId )
→ void
Updates a message in the Firestore. Accepts any message and a
room ID. Message will probably be taken from the messages stream.
updateRoom (Room room )
→ void
updateUserData ({required String userId , String ? firstName , String ? lastName , String ? imageUrl })
→ Future <void >
Updates user data in Firestore (first name, last name, and image URL)