swipe method

void swipe([
  1. DateTime? now
])

Increments the swipe count and checks if the limit is reached. Applies lockout if necessary.

Implementation

void swipe([DateTime? now]) {
  _swipe++;
  if (_swipe >= times) {
    _swipe = 0;
    now ??= DateTime.now();
    final lockoutMillis = now.add(lockoutDuration).millisecondsSinceEpoch;
    writer(_kSwipeLimitationTime, lockoutMillis);
    writer(_kSwipeLimitationTimes, 0);
    notifyListeners();
    _startTimer();
  } else {
    writer(_kSwipeLimitationTimes, _swipe);
  }
}