You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.
This is not a bug. Depending on the platform, dio uses a different adapter (on Web it uses a BrowserHttpClientAdapter, on all other platforms it uses a DefaultHttpClientAdapter).
You are casting your adapter to DefaultHttpClientAdapter but it's actually a BrowserHttpClientAdapter, so your code gives an error. Before casting you should check if it is a DefaultHttpClientAdapter.
if(_dio.httpClientAdapter is DefaultHttpClientAdapter){
//do your code
} else {
//do something else
}
Keep in mind, I don't think it's pssible to ignore certificate errors on web programmatically, this is a browser limitation, not a dio/dart limitation. It should work on web if your website is on the same domain as the api you are calling.
Same request with non signed certificate that in windows, ios, android returns ok, mac not tested, with web project get this error:
Error: Expected a value of type 'DefaultHttpClientAdapter', but got one of type 'BrowserHttpClientAdapter'
This is the code used to avoid certificate error, as I said, work for Androis, iOS and Windows (not tested for Mac):
The text was updated successfully, but these errors were encountered: