1. Home
  2. Docs
  3. Documentation
  4. Core Modules
  5. Chat

Chat

Our chat module, which lives in lib\ui  contains the entire chatting functionality, including groups. Being properly modularized, the chat codebase can easily be integrated into any existing Flutter app, with only a few lines of code.

The main components of the Chat module are:

  • lib\ui \chat\ChatScreen.dart
    • This is the Flutter class that handles the core chat room and its functionality.
    • It can be used for both 1-1 chat rooms as well as group chats
    • It depends on a HomeConversationModel object which contains necessary data that we depend on
    • It communicates with Firebase, via the FireStoreUtils object
    • FireStoreUtils.sendMessage() is one of the most important methods, which is in charge of sending a message and notifying recipients
    • For apps that have audio and video calling integration, the call is being initiated in this component too
    • It looks like this: 
  • lib\ui \chat\PlayerWidget.dart

    • This Flutter widget is responsible for rendering audio messages player into the ChatScreen.dart 
  • lib\ui\conversationsScreen\ConversationsScreen.dart
    • This Flutter widget continuously listens for new messages
    • it displays a horizontal list of current user friends
    • it displays a list of all the conversations of the current user
    • it depends on the user object
    • the top right icon can navigate to CreateGroupScreen.dart 
    • it uses both methods FireStoreUtils.getFriends() and FireStoreUtils.getConversations() to display data
    • it looks like this:
  • lib\ui\createGroup\CreateGroupScreen.dart
    • This is the screen that lets you select multiple friends to create a group chat
    • It consumes FireStoreUtils.getFriends() method to fetch the list of friends
    • it looks like this: