onTokenExpiredRuleOverride property
This method can be used in combination with onTokenExpired
to define a custom rule
to trigger the onTokenExpired
method. By default, onTokenExpired
is fired when
the http response has a 401 status code. Eventually, this rule can be expanded thanks
to this method.
The onTokenExpired
method will be called either when the status code is 401 or
when the response has an error and this method returns true. Check the following code as example.
onTokenExpiredRuleOverride: (response) {
if (response.statusCode == 500 && response.body.contains("missing auth")) {
return true;
}
return false;
}
Implementation
final bool Function(http.Response response)? onTokenExpiredRuleOverride;