initDio static method
Dio
initDio(
{ - required String baseUrl,
- Interceptor? interceptor,
- String proxy = '',
})
Implementation
static Dio initDio(
{required String baseUrl, Interceptor? interceptor, String proxy = ''}) {
if (fastDio == null) {
final BaseOptions options = BaseOptions(
connectTimeout: CONNECT_TIMEOUT,
receiveTimeout: RECEIVE_TIMEOUT,
baseUrl: baseUrl,
);
final _dio = Dio(options);
if (interceptor != null) {
_dio.interceptors.add(interceptor);
}
fastDio = _dio;
if (proxy.isNotEmpty) {
setProxy(fastDio!, proxyUrl: proxy);
}
}
return fastDio!;
}