Getting Started
The LikeMinds Flutter Chat SDK serves as a network layer that wraps around network calls, utilizing appropriate models to facilitate a seamless integration experience with minimal configuration required.
Add dependency
Open the terminal, and run the following command in your Flutter project's directory.
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 the builder pattern provided with the client.
// Initiate the LMChatClient instance
final LMChatClient lmChatClient = (LMChatClientBuilder()
..sdkCallback(lmChatSDKCallback)
..excludedConversationStates(excludedConversationStates ?? []))
.build();
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
}
}