buildAuthenticatedDio function
- required BaseOptions baseOptions,
- required NullParamsInterceptor nullParamsInterceptor,
- required Fresh<
AuthTokenModel> fresh, - required AppExceptionMappingInterceptor exceptionMappingInterceptor,
- required AuthFailureInterceptor authFailureInterceptor,
- required ReportingInterceptor reportingInterceptor,
- required PrettyDioLogger prettyDioLogger,
- List<
String> allowedSHA256Fingerprints = SecurityConstants.allowedSHA256Fingerprints,
Builds the authenticated Dio client, for protected routes.
Interceptor order: null-param removal → fresh (token attach + refresh) →
exception mapping → auth-revocation detection → retry → reporting →
pretty logging (always last).
Implementation
Dio buildAuthenticatedDio({
required BaseOptions baseOptions,
required NullParamsInterceptor nullParamsInterceptor,
required Fresh<AuthTokenModel> fresh,
required AppExceptionMappingInterceptor exceptionMappingInterceptor,
required AuthFailureInterceptor authFailureInterceptor,
required ReportingInterceptor reportingInterceptor,
required PrettyDioLogger prettyDioLogger,
List<String> allowedSHA256Fingerprints = SecurityConstants.allowedSHA256Fingerprints,
}) {
return _buildDio(
baseOptions: baseOptions,
allowedSHA256Fingerprints: allowedSHA256Fingerprints,
interceptors: (Dio dio) => <Interceptor>[
nullParamsInterceptor,
fresh,
exceptionMappingInterceptor,
authFailureInterceptor,
_buildRetryInterceptor(dio),
reportingInterceptor,
prettyDioLogger,
],
);
}