loop_sdk 0.0.1 copy "loop_sdk: ^0.0.1" to clipboard
loop_sdk: ^0.0.1 copied to clipboard

unlisted

Loop SDK for Flutter

Usage #

To integrate LoopFlow into your Flutter application, follow these steps:

Step 1: Add the dependency #

Add the Loop SDK dependency to your pubspec.yaml file:

dependencies:  
 loop_sdk: ^0.0.1  

Step 2: Initialize the Loop SDK #

Initialize the Loop SDK with your credentials:

LoopSDK.initialize(  
userId: "<userId>",  
accessKey: "<accesskey>",  
userAuthToken: "<userAuthToken>",  
);  

Trigger LoopFlow when needed #

Use the following code snippet to trigger the LoopFlow:

Use the loopEventHandler and customEventHandler to handle the events.

                LoopSDK.show(
                  context: context,
                  campaignId: "<campaignID>",
                  campaignKey: <campaignKey>,
                  extraParams: const {
                    "param1": "somevalue",
                    "param2": "65cb3919somevalue7c7436442b3fb0ec"
                  },
                  loopEventHandler: (event, params) {
                    switch (event) {
                      case LoopEvent.ON_FLOW_START:
                        // 'Handle flow start here
                        break;
                      case LoopEvent.ON_FLOW_END:
                        // Handle flow ended
                        break;
                      case LoopEvent.ON_FLOW_DISMISS:
                        // Handle Flow dismissed 
                        break;
                    }
                  },
                  customEventHandler: (eventName, params) {
                    //Handle Custom Event: $eventName
                  },
                  disableFlowEndNavigation: false,
                  disableDeviceBack: false,
                );

Ensure you replace placeholders such as userId, accesskey , etc., with actual values from your Loop configuration.