Getting started
The LikeMinds Flutter Chat SDK empowers you to integrate personalized and interactive chat functionality into your Flutter application, providing seamless communication experiences for your users. This guide will assist you in getting started with the LikeMinds Flutter Chat SDK and setting up a dynamic chatroom in your application. Simply obtain the required API key from the LikeMinds dashboard and unlock the power of real-time messaging in your app.
Add dependency
Then add the package as dependency in pubspec.yaml
dependencies:
likeminds_chat_fl: ^1.2.0
or you can run this command in the terminal
flutter pub add likeminds_chat_fl
Usage
To start using the package, import it in your main.dart
file
import 'package:likeminds_chat_fl/likeminds_chat_fl.dart';
After adding the import, get an instance of the LMChatClient
class using initiateLikeMinds()
static method and initialize it with your API key, and an instance of the LMSdkCallback class.
// Initiate the LMChatClient instance
final LMChatClient lmChatClient = LMChatClient.initiateLikeMinds(
apiKey: "YOUR_LM_API_KEY",
sdkCallback: YOUR_CALLBACK,
);
Maintain this instance of the LMChatClient
class throughout your application. You can use it to access the different methods exposed by the package.
LMSdkCallback
The LMSdkCallback
class is a callback class that is used to listen to analytic events from the LikeMinds Chat package. It has 3 methods that you can override to listen to events from the package.
class YourCallback extends LMSdkCallback {
void eventFiredCallback(String eventKey, Map<String, dynamic> propertiesMap) {
// Implement eventFiredCallback
}
void loginRequiredCallback() {
// Implement loginRequiredCallback
}
void logoutCallback() {
// Implement logoutCallback
}
}
Demo App
You can find a Demo App of how to use the package here within our sample UI package. You can also clone the repo and run the example app on your device.