copyWith method
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,
);
}