FirebaseChatCore class Null safety

Provides access to Firebase chat data. Singleton, use FirebaseChatCore.instance to aceess methods.

Properties

config FirebaseChatCoreConfig
Config to set custom names for rooms and users collections. Also see FirebaseChatCoreConfig.
read / write
firebaseUser User?
Current logged in user in Firebase. Does not update automatically. Use FirebaseAuth.authStateChanges to listen to the state changes.
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

createGroupRoom({String? imageUrl, Map<String, dynamic>? metadata, required String name, required List<User> users}) Future<Room>
Creates a chat group room with users. Creator is automatically added to the group. name is required and will be used as a group name. Add an optional imageUrl that will be a group avatar and metadata for any additional custom data.
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 types.User in Firebase to store name and avatar used on rooms list
deleteUserFromFirestore(String userId) Future<void>
Removes types.User from users collection in Firebase
messages(Room room) Stream<List<Message>>
Returns a stream of messages from Firebase for a given room
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
room(String roomId) Stream<Room>
Returns a stream of changes in a room from Firebase
rooms({bool orderByUpdatedAt = false}) Stream<List<Room>>
Returns a stream of rooms from Firebase. Only rooms where current logged in user exist are returned. orderByUpdatedAt is used in case you want to have last modified rooms on top, there are a couple of things you will need to do though: [...]
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.
setConfig(FirebaseChatCoreConfig firebaseChatCoreConfig) → void
Sets custom config to change default names for rooms and users collcetions. Also see FirebaseChatCoreConfig.
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.
users() Stream<List<User>>
Returns a stream of all users from Firebase

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Properties

instance FirebaseChatCore
Singleton instance
final