copyWith method

AuthTokenModel copyWith({
  1. String? accessToken,
  2. String? refreshToken,
  3. String? tokenType,
  4. int? expiresIn,
  5. int? refreshExpiresIn,
})

Creates a copy of this token with the given fields replaced.

All parameters are optional — omitted fields retain their current values.

final updated = token.copyWith(
  accessToken: newAccessToken,
  expiresIn: newExpirationTime,
);

Implementation

AuthTokenModel copyWith({String? accessToken, String? refreshToken, String? tokenType, int? expiresIn, int? refreshExpiresIn}) {
  return AuthTokenModel(
    accessToken: accessToken ?? this.accessToken,
    refreshToken: refreshToken ?? this.refreshToken,
    tokenType: tokenType ?? this.tokenType,
    expiresIn: expiresIn ?? this.expiresIn,
    refreshExpiresIn: refreshExpiresIn ?? this.refreshExpiresIn,
  );
}