When I attempt a basic http post, I can see that the server is returning a normal 400. But the client seems to just crash with an error I can’t make sense of. I have the following code
static Future<TradApiServerResponse> submitPhone(
String phone, String code) async {
http.Response response = await http.post(
Uri.parse("$urlbase/api/submitphone"),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'code': code,
'phone': phone,
}),
);
if (response.statusCode == 200) {
When stepping trough it never gets to the if statement. It just locks up then crashes. The server is responding. I can curl or use the browser directly and it works fine
Error
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 329:10 createErrorWithStack
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 265:28 _throw
dart-sdk/lib/core/errors.dart 120:5 throwWithStackTrace
dart-sdk/lib/async/zone.dart 1386:11 callback
dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7 <fn>
Application finished.
How can I figure out what the problem is? Sorry I am new to flutter