startAutoRefresh method

void startAutoRefresh()

Starts an auto-refresh process in the background. Close to the time of expiration a process is started to refresh the session. If refreshing fails it will be retried for as long as necessary.

Implementation

void startAutoRefresh() async {
  stopAutoRefresh();

  _autoRefreshTicker = Timer.periodic(
    Constants.autoRefreshTickDuration,
    (Timer t) => _autoRefreshTokenTick(),
  );

  await Future.delayed(Duration.zero);
  await _autoRefreshTokenTick();
}