intFromJsonOrNull function

int? intFromJsonOrNull(
  1. Object? json
)

Reads a JSON number as an int, truncating a double (2.0 → 2).

Implementation

int? intFromJsonOrNull(Object? json) => json is num ? json.toInt() : null;