autoRefresh property

bool get autoRefresh

Specifies if the the account should automatically refresh the idToken.

When enabled, the account will start an internal timer that will timeout roughly one minute before expiresAt and call refresh() to renew the idToken. This loops indenfinitely, until this property has been set to false or the account was disposed of.

Important: If you enable auto refreshing, make sure to always call dispose() when you don't need the account anymore to stop the automatic refreshing.

Implementation

bool get autoRefresh => _refreshTimer != null;
set autoRefresh (bool autoRefresh)

Implementation

set autoRefresh(bool autoRefresh) {
  if (autoRefresh != this.autoRefresh) {
    if (autoRefresh) {
      _scheduleAutoRefresh(_expiresAt.difference(DateTime.now().toUtc()));
    } else {
      _refreshTimer?.cancel();
      _refreshTimer = null;
    }
  }
}