dio.httpClientAdapter as DefaultHttpClientAdapter 在web中会报错,因为flutter web 中dio使用的是 BrowserHttpClientAdapter。
BrowserHttpClientAdapter 中没有设置onHttpClientCreate 方法,请问有解决办法吗?
同问,想设置代理解决跨域问题,浏览器会报: Uncaught (in promise) Error: Expected a value of type 'DefaultHttpClientAdapter', but got one of type 'BrowserHttpClientAdapter'
同问,升级3.6以后这个类没有了
同问,想设置代理解决跨域问题,浏览器会报: Uncaught (in promise) Error: Expected a value of type 'DefaultHttpClientAdapter', but got one of type 'BrowserHttpClientAdapter'
已经解决了跨域的问题,没有使用dio设置代理的方式。使用了issues465中有个大神的解决方案,使用中间件,启动了本地服务,把localhost映射到了要访问的API地址,终于可以在本地跨域调试了。
https://github.com/flutterchina/dio/issues/465
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.
Most helpful comment
同问,升级3.6以后这个类没有了