chaty 1.0.14
chaty: ^1.0.14 copied to clipboard
A Firebase chat widget for Flutter with real-time messaging, media sharing, and easy integration into your apps.
Chaty #
Chaty is a Firebase-powered chat widget designed for seamless integration into Flutter applications. It provides a robust and customizable chat interface with features like real-time messaging, media sharing, and notifications.
Features #
- Real-time Messaging: Send and receive messages instantly using Firebase Firestore.
- Media Sharing: Share images, videos, audio, and documents.
- Customizable UI: Easily customize chat bubbles, input fields, and more.
- Typing Indicators: Show when the other user is typing.
- Unread Message Count: Keep track of unread messages.
- Message Deletion: Delete messages with confirmation.
- Cross-Platform Support: Works on Android, iOS, Web, and Desktop.
Screenshots #
Below are some screenshots of Chaty in action:

Getting Started #
Prerequisites #
- Ensure you have Flutter installed. Follow the Flutter installation guide.
- Set up a Firebase project and enable Firestore.
Setting Up Firebase #
- Go to the Firebase Console.
- Click on Add Project and follow the steps to create a new project.
- Once the project is created, navigate to the Project Settings.
- Under the General tab, add your app:
- For Android, download the
google-services.json
file and place it in theandroid/app
directory. - For iOS, download the
GoogleService-Info.plist
file and place it in theios/Runner
directory.
- For Android, download the
- Enable Firestore:
- Go to the Firestore Database section in the Firebase Console.
- Click on Create Database.
- Choose a Start in production mode or Start in test mode based on your requirements.
- Select a Cloud Firestore location and click Enable.
Installation #
- Add Chaty to your
pubspec.yaml
:dependencies: chaty: ^X.X.X
- Run the following command to install the package:
flutter pub get
Usage #
To integrate Chaty into your Flutter app:
- Import the necessary components:
import 'package:chaty/ui/chat_screen.dart'; import 'package:chaty/models/message.dart';
- Use the
ChatScreen
widget:ChatScreen( senderId: 'user1', receiverId: 'user2', mediaUploaderFunction: (mediaPath) async { // function that upload the mediapath and return the URL return 'uploaded_media_url'; }, );
For more examples, check the /example
folder.
Example #
Here is a minimal example to get started:
import 'package:flutter/material.dart';
import 'package:chaty/ui/chat_list_screen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
/// Checks if the initialization has already been performed and avoids
/// re-initializing if it has. This helps prevent redundant operations
/// or potential errors caused by multiple initializations.
await ChatService.instance.initializeFirebase();//remove if already initalised.
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ChatListScreen(
currentUserId: 'user1',
chatTileBuilder: ({required chatSummary}) {
return ListTile(
title: Text("Chat with ${chatSummary.otherUserId}"),
subtitle: Text(chatSummary.lastMessage),
trailing: Text(chatSummary.lastMessageTime.toLocal().toString()),
onTap: () {
// Navigate to ChatScreen
},
);
},
getnumberOfusers: (int numberOfUsers) {
print("Number of users: $numberOfUsers");
},
),
);
}
}
Additional Information #
- Sample Project: Check out the Fire Chat repository for a complete example of how to use the Chaty plugin in a real-world application.
- Contributing: Contributions are welcome! Feel free to submit issues or pull requests.
- License: This project is licensed under the MIT License. See the LICENSE file for details.
- Support: For any issues or feature requests, please open an issue on GitHub.
Happy coding! I don't want coffee 😊
