copyWith method

OauthToken copyWith(
  1. String accessToken,
  2. int expiresIn, {
  3. String? refreshToken,
  4. String? scope,
})

Refreshes this token with the new accessToken and expiresIn.

Specify the refreshToken when the provider rotated it, otherwise the current one is kept.

Implementation

OauthToken copyWith(
  String accessToken,
  int expiresIn, {
  String? refreshToken,
  String? scope,
}) => OauthToken(
  accessToken: accessToken,
  expiresIn: expiresIn,
  refreshToken: refreshToken ?? this.refreshToken,
  scope: scope ?? this.scope,
  tokenType: tokenType,
  provider: provider,
  created: DateTime.now().toUtc(),
);