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(key: Key("${chatSession.chatRoomId}"),


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>")

widgetListener Api

        session: session,
        widgetListener: (widgetId, widgetKind) {
            print("object>> $widgetId => $widgetKind");

Display Widget in WidgetView using LiveLikeWidget,Enable/Disable Widget Transition, Update State of widget inside WidgetView

final widgetKey = GlobalKey<WidgetViewState>();
//To display call the method

widgets have 4 states to ready,interacting,results,finished

Fetch User Interaction Data based on widgetId and WidgetKind

final interactionData = await session.fetchUserInteractionDataForWidget(widgetId!, widgetKind!);


If you are facing extra padding when keyboard appears in IOS, then add

resizeToAvoidBottomInset: !Platform.IOS,

attribute to your Scaffold to avoid this issue, and make sure it is true for android platform

Widget View with support in ListView

Now widgetView can be used with listview, you need to create an instance of widgetview and assign a key to it and then call the methods to perform the actions , below is the example of how to do this.

        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);

after calling display widget , if you need to change the state of the widget ,make sure to do the task with some delay in time,

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);

the LiveLikePagination enum is used for lazy loading, right now by default widgets loaded a limit of 20, in order

to start the call the api with LiveLikePagination.first which will return you first page data and call api with 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.

Fetch Widget Details

In order to fetch details of a particular widget

await sdk.fetchWidgetDetails(widgetId!, widgetKind!);

The api requried widgetid and widgetKind , and the result will be LiveLikeWidget model class

To fetch WidgetModel using LiveLikeWidget

 final widgetModel = await session.fetchWidgetModel(<LiveLikeWidget class instance>);


Components of WidgetModel:


The instance of the livelikeWidget class which is used to create the widget model, contains the data of the widgets

Vote Api

In Order to vote on a particular option, the voting method is used, it contains optionId and magnitude , magnitude is used for sending vote for Image Slider Widget, and for the rest of the widget the optionId is sent. <value>); <value>)

Vote Result Stream

In Order to receive the vote count for options associated with a widget, the voteResultStream is used. It returns the instance of VoteCountResult class, which contains the option id,vote count,magnitude values

widgetModel?.voteCountResultStream.listen((event) {


The dispose method is used to clear and release the instances associated to widgetModel.



In order to use the native timelineView

        session: _controller.session.value!,
        sepratorHeight: 100,
        onInit: () {} )

Json Theming

added api in widgetView to support json theming

  try {
      await widgetKey.currentState?.setJsonTheme(jsonString);
    } on PlatformException catch (e) {
      if (e.message != null) showErrorMessage(e.message!);