Visitor constructor

Visitor(
  1. FlagshipConfig config,
  2. String visitorId,
  3. Map<String, Object> context, {
  4. bool hasConsented = true,
})

Create new instance for visitor

config: this object manage the mode of the sdk and other params visitorId : the user ID for the visitor context : Map that represent the conext for the visitor

Implementation

Visitor(this.config, this.visitorId, Map<String, Object> context,
    {bool hasConsented = true}) {
  // update context
  this.updateContextWithMap(context);
  // set delegate
  _visitorDelegate = VisitorDelegate(this);
  // set the consent
  _hasConsented = hasConsented;
  // Send the consent hit on false at the start
  if (!_hasConsented) {
    _visitorDelegate.sendHit(Consent(hasConsented: _hasConsented));
  }
}