Skip to content

Commit 75cf916

Browse files
committed
support null-safety & 4.0 beta
1 parent 3418c16 commit 75cf916

33 files changed

+1316
-1103
lines changed

analysis_options.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
include: package:pedantic/analysis_options.yaml
2+
analyzer:
3+
enable-experiment:
4+
- non-nullable

dio/lib/src/adapters/io_adapter.dart

+4-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DefaultHttpClientAdapter implements HttpClientAdapter {
3232
"Can't establish connection after [HttpClientAdapter] closed!");
3333
}
3434
var _httpClient = _configHttpClient(cancelFuture, options.connectTimeout);
35-
Future requestFuture = _httpClient.openUrl(options.method!, options.uri);
35+
Future requestFuture = _httpClient.openUrl(options.method, options.uri);
3636

3737
void _throwConnectingTimeout() {
3838
throw DioError(
@@ -42,7 +42,7 @@ class DefaultHttpClientAdapter implements HttpClientAdapter {
4242
);
4343
}
4444

45-
HttpClientRequest request;
45+
late HttpClientRequest request;
4646
try {
4747
if (options.connectTimeout > 0) {
4848
request = await requestFuture
@@ -60,16 +60,13 @@ class DefaultHttpClientAdapter implements HttpClientAdapter {
6060
_throwConnectingTimeout();
6161
}
6262

63-
request.followRedirects = options.followRedirects ?? true;
64-
request.maxRedirects = options.maxRedirects ?? 5;
65-
6663
if (options.method != 'GET' && requestStream != null) {
6764
// Transform the request data
6865
await request.addStream(requestStream);
6966
}
7067
Future future = request.close();
71-
if (options.connectTimeout != null && options.connectTimeout! > 0) {
72-
future = future.timeout(Duration(milliseconds: options.connectTimeout!));
68+
if (options.connectTimeout > 0) {
69+
future = future.timeout(Duration(milliseconds: options.connectTimeout));
7370
}
7471
late HttpClientResponse responseStream;
7572
try {

0 commit comments

Comments
 (0)