FlagshipConfig constructor

FlagshipConfig(
  1. Mode decisionMode,
  2. int timeout,
  3. int pollingTime,
  4. Level _logLevel,
  5. OnVisitorExposed? onVisitorExposed,
  6. TrackingManagerConfig trackingManagerConfig, {
  7. StatusListener? statusListener,
  8. IVisitorCacheImplementation? visitorCacheImp,
  9. IHitCacheImplementation? hitCacheImp,
  10. bool disableDeveloperUsageTracking = false,
})

Implementation

FlagshipConfig(this.decisionMode, this.timeout, this.pollingTime,
    this._logLevel, this.onVisitorExposed, this.trackingManagerConfig,
    {this.statusListener,
    this.visitorCacheImp,
    this.hitCacheImp,
    this.disableDeveloperUsageTracking = false}) {
  // Set the log Manager
  this.logManager = LogManager(level: _logLevel);
  // Log the timeout value in ms
  this.logManager?.printLog(Level.INFO,
      "The timeout for fetching campaigns is $timeout: ms", false);

  decisionManager = (decisionMode == Mode.DECISION_API)
      ? ApiManager(Service(http.Client()))
      : BucketingManager(Service(http.Client()), this.pollingTime);

  if (this.hitCacheImp == null) {
    this.hitCacheImp = DefaultCacheHitImp();
  }
  if (this.visitorCacheImp == null) {
    this.visitorCacheImp = DefaultCacheVisitorImp();
  }
}