diff --git a/dio/lib/src/dio/dio_for_native.dart b/dio/lib/src/dio/dio_for_native.dart index 8be8d1b68..021507bc0 100644 --- a/dio/lib/src/dio/dio_for_native.dart +++ b/dio/lib/src/dio/dio_for_native.dart @@ -94,7 +94,7 @@ class DioForNative with DioMixin implements Dio { int received = 0; // Stream - final stream = response.data!.stream; + final stream = response.data.stream; bool compressed = false; int total = 0; final contentEncoding = response.headers.value( diff --git a/example/lib/generic.dart b/example/lib/generic.dart index 4106a9107..444f48e15 100644 --- a/example/lib/generic.dart +++ b/example/lib/generic.dart @@ -42,5 +42,5 @@ void main() async { // This is the recommended way. final r = await dio.get('https://baidu.com'); - print(r.data?.length); + print(r.data.length); } diff --git a/example_flutter_app/lib/main.dart b/example_flutter_app/lib/main.dart index 43bb79349..117624921 100644 --- a/example_flutter_app/lib/main.dart +++ b/example_flutter_app/lib/main.dart @@ -66,7 +66,7 @@ class _MyHomePageState extends State { .then((r) { setState(() { print(r.data); - _text = r.data!.replaceAll(RegExp(r'\s'), ''); + _text = r.data.replaceAll(RegExp(r'\s'), ''); }); }); } catch (e) { diff --git a/example_flutter_app/lib/routes/request.dart b/example_flutter_app/lib/routes/request.dart index d44d88eae..eeb5d7a6b 100644 --- a/example_flutter_app/lib/routes/request.dart +++ b/example_flutter_app/lib/routes/request.dart @@ -26,7 +26,7 @@ class _RequestRouteState extends State { onPressed: () { dio.get('https://httpbin.org/get').then((r) { setState(() { - _text = r.data!; + _text = r.data; }); }); }, diff --git a/plugins/cookie_manager/test/cookies_test.dart b/plugins/cookie_manager/test/cookies_test.dart index fbadff939..eb1c44906 100644 --- a/plugins/cookie_manager/test/cookies_test.dart +++ b/plugins/cookie_manager/test/cookies_test.dart @@ -41,6 +41,7 @@ void main() { final firstRequestOptions = RequestOptions(baseUrl: exampleUrl); final mockResponse = Response( + data: null, requestOptions: firstRequestOptions, headers: Headers.fromMap( {HttpHeaders.setCookieHeader: mockFirstRequestCookies}, @@ -76,6 +77,7 @@ void main() { final requestOptions = RequestOptions(baseUrl: exampleUrl); final mockResponse = Response( + data: null, requestOptions: requestOptions, headers: Headers.fromMap( {HttpHeaders.setCookieHeader: mockResponseCookies}, diff --git a/plugins/http2_adapter/example/example.dart b/plugins/http2_adapter/example/example.dart index 2e9449db2..57ea69206 100644 --- a/plugins/http2_adapter/example/example.dart +++ b/plugins/http2_adapter/example/example.dart @@ -14,7 +14,7 @@ void main() async { Response response; response = await dio.get('/?xx=6'); - print(response.data?.length); + print(response.data.length); print(response.redirects.length); print(response.data); }