TokenRefreshStrategyImpl class
The TokenRefreshStrategyImpl class provides a concrete implementation of the TokenRefreshStrategy interface, defining the strategy for refreshing tokens.
- Implemented types
Constructors
-
TokenRefreshStrategyImpl({required TokenRefreshHandler refreshHandler, required TokenExtractor accessTokenExtractor, required TokenExtractor refreshTokenExtractor, List<
int> successCodes = const [200], List<int> refreshCodes = const [401], Map<String, String> authTemplate = const {'Authorization' : 'Bearer '}, int retries = 1}) - Creates a TokenRefreshStrategyImpl with the given parameters.
Properties
- accessTokenExtractor → TokenExtractor
-
The function used to extract the access token from the response.
final
-
authTemplate
→ Map<
String, String> -
The template for the authorization headers.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
refreshCodes
→ List<
int> -
The list of status codes indicating the need to refresh the token.
final
- refreshHandler → TokenRefreshHandler
-
The handler function used to perform the token refresh.
final
- refreshTokenExtractor → TokenExtractor
-
The function used to extract the refresh token from the response.
final
- retries → int
-
The number of retry attempts for refreshing the token.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
successCodes
→ List<
int> -
The list of status codes indicating a successful token refresh.
final
Methods
-
getAuthorizationHeaders(
String accessToken) → Map< String, String> -
Gets the authorization headers using the provided access token.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshToken(
Dio dio, TokenManager tokenManager) → Future< String?> -
Refreshes the token using the provided
Dio
instance and TokenManager.override -
shouldRefreshToken(
Response response) → bool -
Determines if the token should be refreshed based on the given
Response
.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited