execute static method

Future<void> execute({
  1. required String viewName,
  2. Map<String, String> attributes = const {},
  3. RoktCallback onLoad = _defaultRoktCallBack,
  4. RoktCallback onUnLoad = _defaultRoktCallBack,
  5. RoktCallback onShouldShowLoadingIndicator = _defaultRoktCallBack,
  6. RoktCallback onShouldHideLoadingIndicator = _defaultRoktCallBack,
})

Execute Rokt widget

This is the entry point to display a widget to the consumer. The Rokt widget view displays after a short delay, configurable via the Rokt platform. The SDK provides optional callback events for when the view loads and unloads. Your app dictates which consumer attributes are passed through to Rokt

  • Parameters:
    • viewName: The name that should be displayed in the widget
    • attributes: A string map containing the parameters that should be displayed in the widget
    • onLoad: Function to execute right after the widget is successfully loaded and displayed
    • onUnLoad: Function to execute right after widget is unloaded, there is no widget or there is an exception
    • onShouldShowLoadingIndicator: Function to execute when the loading indicator should be shown
    • onShouldHideLoadingIndicator: Function to execute when the loading indicator should be hidden

Implementation

static Future<void> execute(
    {required String viewName,
    Map<String, String> attributes = const {},
    RoktCallback onLoad = _defaultRoktCallBack,
    RoktCallback onUnLoad = _defaultRoktCallBack,
    RoktCallback onShouldShowLoadingIndicator = _defaultRoktCallBack,
    RoktCallback onShouldHideLoadingIndicator = _defaultRoktCallBack}) async {
  _onLoad = onLoad;
  _onUnLoad = onUnLoad;
  _onShouldShowLoadingIndicator = onShouldShowLoadingIndicator;
  _onShouldHideLoadingIndicator = onShouldHideLoadingIndicator;

  await RoktSdkController.instance.execute(
      viewName: viewName,
      attributes: attributes,
      callback: _defaultRoktCallBackInternal);
}