fyrechat 0.0.1 copy "fyrechat: ^0.0.1" to clipboard
fyrechat: ^0.0.1 copied to clipboard

A Firebase-based Flutter chat core package supporting direct and group messaging with seen status, message replies, and Firestore integration.

πŸ”₯ FyreChat #

FyreChat is a lightweight and scalable Firebase-based chat service for Flutter. It allows you to easily implement 1-on-1 and group messaging with full support for message replies, roles, message types (text, image, file, custom), and read receipts β€” all backed by Firebase Firestore.

Built with clean and extensible architecture, FyreChat can power a wide range of real-time chat features in your apps, whether you're building a messenger, team collaboration app, or customer support system.


✨ Features #

  • πŸ” Firebase Authentication integration
  • πŸ§‘β€πŸ€β€πŸ§‘ Direct & group chat room creation
  • πŸ’¬ Send & receive messages (text, image, file, custom)
  • πŸ’¬ Reply to messages
  • πŸ‘ Seen message tracking (seenBy)
  • πŸ”„ Real-time updates via Firestore streams
  • 🧹 Delete messages and rooms
  • πŸ”§ Extensible metadata support
  • πŸ“¦ Designed for package-based modularity

πŸ“¦ Installation #

Add this to your pubspec.yaml:

dependencies:
  firechat: <latest_version>


πŸš€ Getting Started
1. Initialize Firebase
Make sure you’ve initialized Firebase in your app:


void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

2. Use the Singleton Instance
dart
Copy
Edit
final fireChat = FyreChat.instance;
πŸ›  Usage Examples
πŸ” Listen to Current User
dart
Copy
Edit
fireChat.firebaseUser.listen((user) {
  print('Current user: ${user?.uid}');
});
πŸ§‘β€ Create User in Firestore
dart
Copy
Edit
await fireChat.createUserInFirestore(
  uid: 'user_123',
  name: 'Kham',
  imageUrl: 'https://example.com/avatar.png',
);
πŸ’¬ Send a Text Message
dart
Copy
Edit
await fireChat.sendMessage(
  roomId: 'room_abc',
  author: yourUser,
  text: 'Hello there!',
);
πŸ’¬ Send a Message with Reply
dart
Copy
Edit
await fireChat.sendMessageReply(
  roomId: 'room_abc',
  author: yourUser,
  text: 'This is a reply!',
  repliedMessage: originalMessage,
);
πŸ§‘β€πŸ€β€πŸ§‘ Create a Direct Chat Room
dart
Copy
Edit
final room = await fireChat.createRoom(
  user1Id: 'user_a',
  user2Id: 'user_b',
);
πŸ‘₯ Create a Group Room
dart
Copy
Edit
final room = await fireChat.createGroupRoom(
  userIds: ['user1', 'user2', 'user3'],
  currentUser: yourUser,
  groupName: 'Study Group',
  groupImage: 'https://example.com/group.png',
);
πŸ”„ Listen to Messages in a Room
dart
Copy
Edit
fireChat.messages('room_abc').listen((messages) {
  for (var msg in messages) {
    print('${msg.author.id}: ${msg.text}');
  }
});
πŸ‘ Mark Messages as Seen
This is automatic when streaming messages, but you can implement manual seen marking if needed:

dart
Copy
Edit
await fireChat.markMessagesAsSeen(roomId: 'room_abc', userId: 'your_user_id');
πŸ“ Firestore Structure
Here’s an example structure used by FyreChat:

css
Copy
Edit
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)
πŸ“Œ Requirements
Firebase (Firestore + Auth)

Flutter 3.10 or newer

Dart 3.x

πŸ§ͺ Coming Soon
βœ… Typing indicator support

βœ… Push notifications

βœ… Message editing

βœ… Group member roles (admin/mod)

🀝 Contribution
Contributions are welcome! Feel free to open issues or submit pull requests.

Setup for Development
bash
Copy
Edit
git clone https://github.com/your_username/firechat.git
cd firechat
flutter pub get
πŸ“„ License
This project is licensed under the MIT License. See the LICENSE file for details.

0
likes
0
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

A Firebase-based Flutter chat core package supporting direct and group messaging with seen status, message replies, and Firestore integration.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cloud_firestore, equatable, firebase_auth, flutter, json_annotation, meta

More

Packages that depend on fyrechat