Getting Started
The LikeMinds Flutter Feed SDK provides a robust solution to seamlessly integrate dynamic and engaging feed experiences into your Flutter application. This guide walks you through setting up the LikeMinds Flutter Feed SDK, empowering you to deliver personalized content efficiently. Obtain the necessary API key from the LikeMinds dashboard.
Prerequisites
Before getting started, ensure you have:
- Flutter Version: Your Flutter version should be 3.19.0 or higher.
Step-by-Step Integration Guide
Follow these steps to integrate the LikeMinds Feed SDK into your Flutter application:
Step 1 - Installation
Open the terminal, and run the following command in your Flutter project's directory.
flutter pub add likeminds_feed_flutter_core
Step 2 - Setup LikeMinds Feed
Setup the LMFeedCore package in the main function with the following code
- Social Feed
- QnA Feed
- Video Feed
main(){
WidgetsFlutterBinding.ensureInitialized();
// Call setup function before the runApp() function
await LMFeedCore.instance.initialize(
// configure social feed theme
config: LMFeedConfig(
feedThemeType: LMFeedThemeType.social,
),
);
...
runApp(YourApp());
}
main(){
// Call setup function before the runApp() function
await LMFeedCore.instance.initialize(
// configure qna feed theme
config: LMFeedConfig(
feedThemeType: LMFeedThemeType.qna,
),
);
...
runApp(YourApp());
}
main(){
// Call setup function before the runApp() function
await LMFeedCore.instance.initialize(
// configure video feed theme
config: LMFeedConfig(
feedThemeType: LMFeedThemeType.videoFeed,
),
);
...
runApp(YourApp());
}
Step 3 - Initiate User Session
You have successfully initiated the LMFeedCore. Now, you have to initiate a user session. Provide API Key directly to LikeMinds Feed SDK, which will be used to initiate a user session by calling LMFeedCore.showFeedWithApiKey().
// initiate user session, use the response to check for any errors
LMResponse<void> response = await LMFeedCore.instance.showFeedWithApiKey(
apiKey : "YOUR_API_KEY",
uuid : "USER_ID",
userName : "USER_NAME",
);
For enhanced security, you can use Server Side User Authentication to initiate user sessions through your own server.
Step 4 - Navigation to the feed
On successful response of the above snippet you can simply navigate to the Feed Screen, and start using Feed in your app
- Social Feed
- QnA Feed
- Video Feed
if (response.success) {
// create route with LMFeedSocialScreen
MaterialPageRoute route = MaterialPageRoute(
builder: (context) => const LMFeedSocialScreen(),
);
// navigate to LMFeedSocialScreen
Navigator.pushReplacement(context, route);
}
if (response.success) {
// create route with LMFeedQnAScreen
MaterialPageRoute route = MaterialPageRoute(
builder: (context) => const LMFeedQnAScreen(),
);
// navigate to LMFeedQnAScreen
Navigator.pushReplacement(context, route);
}
if (response.success) {
// create route with LMFeedVideoFeedScreen
MaterialPageRoute route = MaterialPageRoute(
builder: (context) => const LMFeedVideoFeedScreen(),
);
// navigate to LMFeedVideoFeedScreen
Navigator.pushReplacement(context, route);
}
By choosing the appropriate method based on your backend infrastructure and security preferences, you can seamlessly integrate the Feed SDK into your application while ensuring secure and efficient session management.