I am doing a post request like this in flutter using HTTP dart package but sometimes when the network fails a ClientException is thrown from IOClient class but I don't get anything in catch block and app crashes.
http.post(url, headers: headers, body: body).then((response) {
//response parsing
}).catchError((error) {
//ClientException is never catched in this block.
});
try{ ... } catch (e) { }?onErroras shown in dartlang.org/guides/libraries/futures-error-handling