looseInt function

int? looseInt(
  1. Object? value
)

An int from an int, a whole double (15000.0) or a numeric string ("15000"); null otherwise.

Implementation

int? looseInt(Object? value) {
  final n = looseNum(value);
  if (n == null || n.isNaN || n.isInfinite || n != n.truncateToDouble()) {
    return null;
  }
  return n.toInt();
}