Reads a JSON number as an int, truncating a double (2.0 → 2).
int
2.0
2
int? intFromJsonOrNull(Object? json) => json is num ? json.toInt() : null;