asInt method
解析成int值
Implementation
int asInt(String key, [int? defValue]) {
if (this == null) return defValue ?? 0;
Object? value = this![key];
if (value == null) return defValue ?? 0;
if (value is int) return value;
try {
int result = int.parse(value.toString());
return result;
} catch (e) {
print(e);
_print('json parse failed,exception value::\"$key\":$value');
_printDetail('asInt', key, this);
}
return defValue ?? 0;
}