BaseRefreshTokensDelegate class abstract
RefreshTokensDelegate that includes base implementation for token refreshing operations. Override the implementations that does not fit in your API requirements.
- Inheritance
-
- Object
- RefreshTokensDelegate
- BaseRefreshTokensDelegate
Constructors
- BaseRefreshTokensDelegate(TokenStorage tokenStorage)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tokenStorage → TokenStorage
-
final
Methods
-
appendAccessTokenToRequest(
Options options, TokenPair? tokenPair) → Options -
Calls to attach access token to authorised request.
override
-
getTokens(
) → Future< TokenPair> -
Load from storage already received and saved token pair
for continuing a user session.
override
-
isAccessTokenExpired(
DioException error) → bool -
Calls to determine if the request failed
because the access token expired or not.
If so, the refresh token process will be started.
override
-
isRefreshTokenExpired(
DioException error) → bool -
Calls to determine if the request failed
because the refresh token expired or not.
If so,
onTokensRefreshingFailed
will be called.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTokensRefreshingFailed(
) → void -
This method will be called when API cannot update token pair
because of the refresh token is expired.
User should be redirected to sign-in screen in that case.
override
-
refreshTokens(
Dio dio, TokenPair tokenPair) → Future< TokenPair> -
Request for tokens refreshing.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateTokens(
TokenPair tokenPair) → Future< void> -
Calls when the API returns a new tokens pair.
Save tokens to storage here for continuing user session later.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited