intOf<T> static method

T intOf<T>(
  1. dynamic json
)

Implementation

static T intOf<T>(json) {
  if (json == null) return null as T;
  if (json is int) {
    return json as T;
  } else if (json is num) {
    return json.toInt() as T;
  } else {
    return null as T;
  }
}