getDio method
Implementation
Dio getDio(String? accessToken){
Dio dio = Dio();
const String staging = String.fromEnvironment('STAGING');
const String baseUrl = staging=='true' ? String.fromEnvironment('staging_url') :
'https://open-api.pipwave.com';
dio..options = BaseOptions(
validateStatus: (status) =>true,
baseUrl: baseUrl,
)..interceptors.addAll([
RetryInterceptor(
dio: dio,
logPrint: (data){
print('RETRY: $data');
},
)
]);
if((accessToken??'').isNotEmpty){
dio.options.headers.addAll({
"Authorization": accessToken,
});
}
return dio;
}