Getting Started
The LikeMinds Flutter Feed SDK empowers you to integrate personalized and engaging feeds into your Flutter application, enhancing user experiences and driving user engagement. This guide will walk you through the steps to get started with the LikeMinds Flutter Feed SDK and set up a dynamic feed in your application. Obtain the necessary API key from the LikeMinds dashboard.
Add Dependency
Add likeminds_feed
as a dependency in your pubspec.yaml
file
dependencies:
likeminds_feed: ^latest
or you can run this command in the terminal
flutter pub add likeminds_feed
Usage
To start using the package, import it in your main.dart
file
import 'package:likeminds_feed/likeminds_feed.dart';
To initiate LikeMinds SDK in your code, use the LMFeedClientBuilder
class to build an instance of the LMFeedClient
class. The LMFeedClientBuilder
class has a build()
method that returns the LMFeedClient
instance.
// Initiate the LMFeedClient instance
final LMFeedClient lmFeedClient = (LMFeedClientBuilder()
..apiKey("YOUR_LM_API_KEY")
..sdkCallback(YOUR_CALLBACK))
.build();
Maintain this instance of the LMFeedClient
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 Feed package. It has 4 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
}
// This method is called when the user profile (tag, header) is clicked
void profileRouteCallback({required String lmUserId}) {}
}
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.