File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change
1
+ import 'dart:async' ;
2
+
1
3
import 'package:http/http.dart' ;
2
4
3
5
///Interceptor interface to create custom Interceptor for http.
@@ -26,11 +28,11 @@ import 'package:http/http.dart';
26
28
///}
27
29
///```
28
30
abstract class InterceptorContract {
29
- Future <bool > shouldInterceptRequest () async => true ;
31
+ FutureOr <bool > shouldInterceptRequest () => true ;
30
32
31
- Future <BaseRequest > interceptRequest ({required BaseRequest request});
33
+ FutureOr <BaseRequest > interceptRequest ({required BaseRequest request});
32
34
33
- Future <bool > shouldInterceptResponse () async => true ;
35
+ FutureOr <bool > shouldInterceptResponse () => true ;
34
36
35
- Future <BaseResponse > interceptResponse ({required BaseResponse response});
37
+ FutureOr <BaseResponse > interceptResponse ({required BaseResponse response});
36
38
}
Original file line number Diff line number Diff line change @@ -36,14 +36,13 @@ import 'package:http/http.dart';
36
36
abstract class RetryPolicy {
37
37
/// Defines whether the request should be retried when an Exception occurs
38
38
/// while making said request to the server.
39
- Future <bool > shouldAttemptRetryOnException (
40
- Exception reason, BaseRequest request) async =>
39
+ FutureOr <bool > shouldAttemptRetryOnException (
40
+ Exception reason, BaseRequest request) =>
41
41
false ;
42
42
43
43
/// Defines whether the request should be retried after the request has
44
44
/// received `response` from the server.
45
- Future <bool > shouldAttemptRetryOnResponse (BaseResponse response) async =>
46
- false ;
45
+ FutureOr <bool > shouldAttemptRetryOnResponse (BaseResponse response) => false ;
47
46
48
47
/// Number of maximum request attempts that can be retried.
49
48
final int maxRetryAttempts = 1 ;
You can’t perform that action at this time.
0 commit comments