chaty 1.0.14 copy "chaty: ^1.0.14" to clipboard
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:

logo

Getting Started #

Prerequisites #

  1. Ensure you have Flutter installed. Follow the Flutter installation guide.
  2. Set up a Firebase project and enable Firestore.

Setting Up Firebase #

  1. Go to the Firebase Console.
  2. Click on Add Project and follow the steps to create a new project.
  3. Once the project is created, navigate to the Project Settings.
  4. Under the General tab, add your app:
    • For Android, download the google-services.json file and place it in the android/app directory.
    • For iOS, download the GoogleService-Info.plist file and place it in the ios/Runner directory.
  5. 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 #

  1. Add Chaty to your pubspec.yaml:
    dependencies:
      chaty: ^X.X.X
    
  2. Run the following command to install the package:
    flutter pub get
    

    logo logo

Usage #

To integrate Chaty into your Flutter app:

  1. Import the necessary components:
    import 'package:chaty/ui/chat_screen.dart';
    import 'package:chaty/models/message.dart';
    
  2. 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 😊

contact us

logo
6
likes
130
points
113
downloads

Publisher

verified publishermindster.com

Weekly Downloads

A Firebase chat widget for Flutter with real-time messaging, media sharing, and easy integration into your apps.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cloud_firestore, firebase_core, firebase_messaging, firebase_storage, flutter, flutter_local_notifications, http, image_picker, path_provider, permission_handler, provider

More

Packages that depend on chaty