Step4. Chatting

    Step4. Chatting


    Article summary

    Preparing to Use Chat

    To enable chat, you must first configure user access permissions for chat in the Shoplive Admin console.

    Please refer to the guide below.

    If guest chat is disabled, you can prompt users to log in by using command information received from the web.


    handleReceviedCommand

    The Shoplive Flutter SDK delivers command information received from the web through this callback.

    receivedCommand.listen((data) { ... })

    Parameter name

    Type

    Description

    command

    String

    Command name

    data

    Map<String, dynamic>

    Data delivered together with the command

    Sample Code

    _shopLivePlayer.receivedCommand.listen((data) {
      switch (data.command) {
        case "LOGIN_REQUIRED":
          // Navigate to the login screen
          // After successful login, link the authenticated user account
          // and relaunch the Shoplive Player      
           _shopLivePlayer.startPictureInPicture();
          // Logic to navigate to the login screen
          break;
        case "CLICK_PRODUCT_CART":
          // Handle add-to-cart logic
          break;
        default:
          break;
      }
    });


    What's Next