int asInt(Map<String, dynamic>? json, String key, {int defaultValue = 0}) { if (json == null || !json.containsKey(key)) return defaultValue; return toInt(json[key]); }