keepActive method

void keepActive([
  1. bool active = true
])

Keeps the _isActive status as active.

Implementation

void keepActive([bool active = true]) {
  if (_isActive != active) {
    _isActive = active;
    _activityController?.add(active);
  }

  activityTimer?.cancel();

  if (active) {
    activityTimer = Timer(_activityTimeout, () {
      _isActive = false;
      _activityController?.add(false);
    });
  }
}