Add this to your pubspec.yaml:
dependencies:
firechat: <latest_version>Check out the full example project on GitHub:
👉 Example App on GitHub
Make sure you’ve initialized Firebase in your app:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}final fireChat = FyreChat.instance;fireChat.firebaseUser.listen((user) {
print('Current user: ${user?.uid}');
});await fireChat.createUserInFirestore(
uid: 'user_123',
name: 'John',
imageUrl: 'https://example.com/avatar.png',
);await fireChat.sendMessage(
roomId: 'room_abc',
author: yourUser,
text: 'Hello there!',
);await fireChat.sendMessageReply(
roomId: 'room_abc',
author: yourUser,
text: 'This is a reply!',
repliedMessage: originalMessage,
);final room = await fireChat.createRoom(
user1Id: 'user_a',
user2Id: 'user_b',
);final room = await fireChat.createGroupRoom(
userIds: ['user1', 'user2', 'user3'],
currentUser: yourUser,
groupName: 'Study Group',
groupImage: 'https://example.com/group.png',
);fireChat.messages('room_abc').listen((messages) {
for (var msg in messages) {
print('${msg.author.id}: ${msg.text}');
}
});This is automatic when streaming messages, but you can implement manual seen marking if needed:
await fireChat.markMessagesAsSeen(
roomId: 'room_abc',
userId: 'your_user_id',
);Here’s an example structure used by FyreChat:
Firestore Root
├── rooms (Collection)
│ └── {roomId} (Document)
│ ├── userIds: [uid1, uid2]
│ ├── type: 'group' or 'direct'
│ └── ...
│
├── messages/{roomId} (Subcollection)
│ └── {messageId}
│ ├── author: {id, name, imageUrl}
│ ├── text / imageUrl / fileUrl
│ ├── seenBy: { uid1: timestamp, uid2: timestamp }
│ └── metadata (including reply info)
- Firebase (Firestore + Auth)
- Flutter 3.10 or newer
- Dart 3.x
- ✅ Typing indicator support
- ✅ Push notifications
- ✅ Message editing
- ✅ Group member roles (admin/mod)
Contributions are welcome! Feel free to open issues or submit pull requests.
git clone https://github.com/khamenkhai/fyre_chat
cd firechat
flutter pub getThis project is licensed under the MIT License. See the LICENSE file for details.