Making dio.post throws uncaught exception
myAsync() async{
try {
Response response = await dio
.post(_appStore.getURL("test/1"), data: formData);
return true;
} catch (e) {
print(e);
}
}
The server requires GET and not POST so I should get an error 405.
The problem is that the try/catch is not working somehow. When I run the app is pointing as an uncaught exception the exception not being caught.
Flutter (Channel dev, v1.6.3, on Mac OS X 10.14.4 18E226, locale en-RO)
• Flutter version 1.6.3 at /Users/cosinus/flutter
• Framework revision bc7bc94083 (5 days ago), 2019-05-23 10:29:07 -0700
• Engine revision 8dc3a4cde2
• Dart version 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)

Thank you
I think is something wrong with the debugger, it seems that it treats handled exceptions as uncaught.
Yes running flutter run everything is working fine.
There is some issue inside the lib, it may require some fix. Is the only lib that causes this kind of problem on VM
Same problem here I was wondering why my stream wouldn't work :')
Same problem...
Getting this.
Any update on this? Got the same problem.
Please update to 3.0.x and try again. if the problem still exists, reopen this issue .
:octocat: From gitme Android
@wendux just added the dependency and the bug is still there
same here
I'm getting this too
Still getting this issue (version 3.0.9)
Still getting this issue (version 3.0.8). What sucks is that I don't feel good publishing a production application with a potential app-crashing bug in it.
From looking into the way the plugin is written, it's possible that it happens because of how Dart handles error throwing in debug mode, will look into it more and update this comment if I find anything.
myAsync() async {
Response response = await dio
.post(_appStore.getURL("test/1"), data: formData)
.catchError((error) {
print(error);
});
}
I'm able to catch error this way, using the .catchError
This is not an error with Dio. Try running your code with flutter run and it will work fine.
Having this issue with dio 3.0.10 on iOS 14 with Flutter beta 1.22. Doesn't occur on Android though.
i am handle in this way on debug mode I know its not good practice
Options(
headers: {'Authorization': 'Bearer $token'},
followRedirects: false,
validateStatus: (status) {
return status <= 500;
}
)
Most helpful comment
I'm able to catch error this way, using the
.catchError