getSnowplowClient static method

Future<SnowplowTracker?> getSnowplowClient({
  1. String? mid,
  2. Environment? environment,
  3. String? merchantType,
})

Implementation

static Future<SnowplowTracker?> getSnowplowClient({
  String? mid,
  Environment? environment,
  String? merchantType,
}) async {
  final snowplowTrackingEnabled = await cacheInstance.getValue(
    cdnConfigInstance.getKeys(StorageKeyKeys.isSnowplowTrackingEnabled)!,
  );

  if (snowplowTrackingEnabled == 'true' &&
      _snowplowClient == null &&
      mid != null &&
      environment != null) {
    await initializeSnowplowClient(
      mid: mid,
      environment: environment,
      merchantType: merchantType ?? 'shopify',
    );
  }

  return _snowplowClient;
}