class Reg_Result { final int id; const Reg_Result({required this.id}); factory Reg_Result.fromJson(Map<String, dynamic> json) { return Reg_Result(id: json['user_id']); } }**your text
**
Null is not a subtype of int.
CodePudding user response:
First make sure if your id is coming or not, seems like your id is not coming that's why it is showing error
CodePudding user response:
The code you provided is correct. The problem I think is where you are giving calling the class and giving the id, this error means you're id received a null value, not an int. It will be better if you can provide the code of where the class is called.