readInt method
Implementation
int readInt(dynamic json, String key) {
dynamic result = json[key];
if (result == Null || result == null) {
return 0;
}
if (result is int) {
return result;
}
if (result is double) {
return result.toInt();
}
if (result is num) {
return result.toInt();
}
return int.tryParse(result.toString()) ?? 0;
}