init static method

void init(
  1. String apiKey,
  2. String userId, {
  3. String endpoint = '',
})

Implementation

static void init(String apiKey, String userId, {String endpoint = ''}) {
  _injectScripts(() {
    plotlineFunc = web.window.getProperty("plotline".toJS) as JSFunction?;
    if (endpoint != '') {
      plotlineFunc?.callAsFunction(
          null, "init".toJS, apiKey.toJS, userId.toJS, endpoint.toJS);
    } else {
      print("endpoint is empty");
      plotlineFunc?.callAsFunction(
          null, "init".toJS, apiKey.toJS, userId.toJS, endpoint.toJS);
    }
    _getScreenshot = getScreenshot.toJS;
    _getVisibleElements = getVisibleElements.toJS;
    _areElementsPresent = areElementsPresent.toJS;
    _getElementBounds = getElementBounds.toJS;
    _getCurrentPageId = getCurrentPageId.toJS;
    print("[Plotline Flutter Web] Allowed interop for getCurrentPageId");
    _overrideInternals();
    print("[Plotline Flutter Web] Overridden Internals");
  });
  print("[Plotline Flutter Web] Initialised Successfully with version 1.0.3");
}