$int function

int $int(
  1. Object? v,
  2. String path
)

Reads an integer (an integral num is accepted).

Implementation

int $int(Object? v, String path) {
  if (v is int) return v;
  if (v is num && v == v.truncate()) return v.toInt();
  throw _wrong(path, 'integer', v);
}