How to get return POST API in Flutter
you should parse the JSON from response.body not the body directly.
Future<User> login(String username, String password) {return _netUtil.post(LOGIN_URL, body: { "username": username, "password": password}).then((response) { //check response status, if response status OK print("Response Status : $res"); if(response.statusCode == 200){ var data = json.decode(response.body); if(data.length>0){ //Convert your JSON to Model here } else{ //Get Your ERROR message's here var errorMessage = data["error_msg"]; } }});