본문 바로가기
개발노트/Flutter

[Flutter] dio 통신 interceptor retry 사용하기

by 전지적진영시점 2023. 4. 11.
반응형

 

개발 환경

---------------------------------

OS : Mac

개발 툴 : android studio

개발 언어 : dart

개발 프레임워크 : flutter

---------------------------------

 

_dio.interceptors.add(RetryInterceptor(
  dio: _dio,
  logPrint: print, // specify log function (optional)
  retries: 2, // retry count (optional)
  retryDelays: const [ // set delays between retries (optional)
    Duration(seconds: 1), // wait 1 sec before first retry
    Duration(seconds: 10), // wait 2 sec before second retry
    Duration(seconds: 3), // wait 3 sec before third retry
  ],
));
반응형

댓글