livelike_flutter_sdk
The Official Flutter LiveLike SDK
Documentation
HomePage
Create Engagement SDK instance
final sdk = EngagementSDK("<client-id>");
Create Engagement SDK instance with access token support
final sdk = EngagementSDK.accessToken("<client-id>","<saved-access-token>",(accessToken){
//fetched access token
});
Error Delegate Support
sdk.errorStream.listen((error) {
print("Error: $error");
//Getting error from any where from the sdk
});
ChatView
ChatView(key: Key("${chatSession.chatRoomId}"),
session:chatSession!);
WidgetView(session: session!,
key: Key(session!.programId!));
Leaderboard API's
Getting Leaderboard associated with a Program
final List<LeaderBoard> list = await sdk.getLeaderBoards("<program-id>");
Getting leaderboard details
final LeaderBoard detail=await sdk.getLeaderBoardDetails("<leaderBoardId>");
Getting leaderboard entries
final List<LeaderBoardEntry> result = await sdk.getEntriesForLeaderBoard(
"<leaderboard-id>", "<LiveLikePagination>");
Getting leaderboard entry for a given profile
final LeaderBoardEntry result = await sdk.getLeaderBoardEntryForProfile(
"<leaderboard-id>", "<profile-id>");
Getting a leaderboard entry for the current user profile
final LeaderBoardEntry result = await sdk.getLeaderBoardEntryForCurrentUserProfile("<leaderboard-id>");
final sposnors =await sdk.sponsor.fetchByProgramId("<program-id>")
WidgetView(
session: session,
widgetListener: (widgetId, widgetKind) {
print("object>> $widgetId => $widgetKind");
},
)
final widgetKey = GlobalKey<WidgetViewState>();
WidgetView(
key:widgetKey
)
//To display call the method
widgetKey.currentState?.displayWidget(widget);
widgetKey.currentState?.enableDefaultWidgetTransition(false);
widgetKey.currentState?.setWidgetState(WidgetState.Result);
final interactionData = await session.fetchUserInteractionDataForWidget(widgetId!, widgetKind!);
Note
resizeToAvoidBottomInset: !Platform.IOS,
final key = GlobalKey<WidgetViewState>();
final widgetView = WidgetView(
key: key,
widgetListener: (id, kind) {
// print("WidgetView>> $id >> $index");
},
showWidgetViewWithDefaultHeight: true,
onWidgetViewInit: () {
if (key.currentState != null) {
await key.currentState!.enableDefaultWidgetTransition(false);
await key.currentState!.showDismissButton(false);
await key.currentState!.displayWidget(widget);
await Future.delayed(const Duration(seconds: 2));
await key.currentState!.setWidgetState(WidgetState.results);
}
},
);
we will be adding support for this future.
To fetch List of Posted Widgets for a given Program
In order to fetch the posted widgets associated to a program , you need to call the getPostedWidget api of session class
final list = await session?.getPublishedWidgets(LiveLikePagination.first);
to start the call the api with LiveLikePagination.first which will return you first page data and call api with LiveLikePagination.next which will get next page data and similarly LiveLikePagination.previous will get previous page data, in next once you get the empty array you have reached the last page.
await sdk.fetchWidgetDetails(widgetId!, widgetKind!);