-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while using #11
Comments
反复测试发现是在app启动后一段时间这部分异常,加了个try之后可以正常拿到body,header索性忽略了 |
非常感谢你的反馈,但我这边并没有复现呢。 var _dio = Dio(
BaseOptions(
baseUrl: "https://www.wanandroid.com/",
contentType: "application/x-www-form-urlencoded; charset=utf-8")
)
..interceptors.add(_manager.interceptor)
..interceptors.add(LogInterceptor(responseBody: true));
void rq() {
_dio.post(
"www.baidu.com",
data: {'k': "keyword"},
options: buildCacheOptions(Duration(hours: 1)))
.then((response) {
print(">>> ${response.data}");
});
} 或者提供一个能重现 crash 的 demo 就更好了。 |
的确是这样的,我将dio封装了一下,一开始token默认为null然后返回认证失败的时候再请求token
所以app的第一次请求header里的token是null。 |
Hi, 0.2.1 版本应该就没问题拉。 |
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: NoSuchMethodError: The method 'trim' was called on null.
Receiver: null
Tried calling: trim()
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1 Headers.set (package:dio/src/headers.dart:61:27)
#2 Headers.add (package:dio/src/headers.dart:49:29)
#3 DioCacheManager._buildResponse. (package:dio_http_cache/src/manager_dio.dart:65:47)
#4 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
#5 DioCacheManager._buildResponse (package:dio_http_cache/src/manager_dio.dart:65:21)
#6 DioCacheManager._onError (package:dio_http_cache/src/manager_dio.dart:58:16)
#7 InterceptorsWrapper.onError (package:dio/src/interceptor.dart:125:14)
#8 DioMixin._request._errorInterceptorWrapper. (package:dio/src/dio.dart:846:40)
#9 _rootRunUn<…>
The text was updated successfully, but these errors were encountered: