interact method

void interact({
  1. dynamic noTriggering = false,
  2. List? interactionParameters,
  3. bool ignoreConsecutiveEqualsParameters = false,
})

Marks an interaction and schedules delayed trigger.

noTriggering If true won't schedule trigger, only mark interaction. interactionParameters Stores parameters that can be used while triggering, using lastInteractionParameters.

Implementation

void interact(
    {noTriggering = false,
    List? interactionParameters,
    bool ignoreConsecutiveEqualsParameters = false}) {
  noTriggering ??= false;

  if (interactionParameters != null) {
    if (ignoreConsecutiveEqualsParameters) {
      if (_lastInteractionParameters != null &&
          isEqualsDeep(_lastInteractionParameters, interactionParameters)) {
        log('ignore interact', [noTriggering, interactionParameters]);
        return;
      }
    }

    _lastInteractionParameters = interactionParameters;
  }

  log('interact', [noTriggering, interactionParameters]);

  var now = this.now;

  _lastInteractionTime = now;
  _initInteractionTime ??= now;
  _interactionNotTriggered = true;

  if (!noTriggering) {
    _scheduleTrigger(triggerDelayMs);
  }
}