been struggling wit the same error since yesterday... whats strange that POST req is fired, but the exception was thrown anyway..
in my case, the problem was one of the temporary functions returning the response:
// Response registerResponse = await dio.post(Strings.USER_REGISTER_URL, data: requestBody, options: new Options(contentType: ContentType("application", "json"))); // print(TAG + registerResponse.toString()); // print(TAG + registerResponse.data.toString()); // Map<String, dynamic> parsedregisterResponse = jsonDecode(registerResponse.data); // print(TAG + "response: " + parsedregisterResponse.toString());
used to monitor the output - will find out which one (probably Map) this evening and let u know. In the meantime recheck your response type and decoding -there must be something wrong with it just like in my case.