livelike_flutter_sdk 0.1.0-prerelease.0 livelike_flutter_sdk: ^0.1.0-prerelease.0 copied to clipboard
To use the services and features of LiveLike SDK
livelike_flutter_sdk #
The Official Flutter LiveLike SDK #
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
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>");
Sponsor APi
final sposnors =await sdk.sponsor.fetchByProgramId("<program-id>")
widgetListener Api
WidgetView(
session: session,
widgetListener: (widget) {
//LiveLikeWidget
},
)
Display Widget in WidgetView using LiveLikeWidget,Enable/Disable Widget Transition, Update State of widget inside WidgetView
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);
Fetch User Interaction Data based on widgetId and WidgetKind
final interactionData = await session.fetchUserInteractionDataForWidget(widgetId!, widgetKind!);