initialize method

Future<void> initialize({
  1. dynamic obslySDK,
})

Initialize the bridge and connect rules controller to Obsly SDK This method should be called from the app after both SDKs are initialized

Implementation

Future<void> initialize({
  dynamic obslySDK,
}) async {
  if (_isConnected) {
    ObslyLogger.debug('Rules-Obsly bridge already connected');
    return;
  }

  try {
    // Set the Obsly SDK reference in the rules controller
    if (obslySDK != null) {
      RulesController.instance.setObslySDK(obslySDK);
      _isConnected = true;
      ObslyLogger.debug('Rules-Obsly bridge connected successfully');
      ObslyLogger.debug('Rules will now create events in Obsly SDK');
    } else {
      ObslyLogger.warn('No Obsly SDK instance provided to bridge');
    }
  } catch (e) {
    ObslyLogger.error('Failed to connect Rules-Obsly bridge: $e');
  }
}