I use this json to list stocks(BIST).
CodePudding user response:
As for your model class, there are many fields contains int. It would be nice to if it possible to parse data 1st, then convert to int. Also same goes for double value.
on fromJson
sembolid: int.tryParse("${json["sembolid"]}"),
while sembolid
accept null data you can do it. If the field isnt nullable provide a default value
sembolid: int.tryParse("${json["sembolid"]}")??0,//here 0 is default value
same thing goes for double value