I send request and i have an exception this is model class:
class User{
String mobileId , username;
User({this.username,this.mobileId});
factory User.fromJson(Map<String, dynamic> json){
return User(
username: json['userName'],
mobileId: json['mobileId'],
);
}
}
this is the function which i send request
Future<User> sendRequest(String mobileId , String username)async{
http.Response response = await http.post('http://94.237.88.194:8080/player',
body:jsonEncode(<String,String>{
'userName' : username,
'mobileId' : mobileId,
}),
);
print(response.statusCode);
return User.fromJson(jsonDecode(response.body));
}