intFromJson static method
Implementation
static int? intFromJson(Map<String, dynamic> json, String attribute,
{int? defaultValue}) {
try {
if (json[attribute] != null) {
if (json[attribute] is int) {
return json[attribute];
}
return int.parse(json[attribute]);
}
return defaultValue;
} catch (e) {
throw Exception('Error while parsing $attribute[$e]');
}
}