isInt function

bool isInt(
  1. Object? value
)

Returns true if value is int. Can be a int as string too.

Implementation

bool isInt(Object? value) {
  if (value == null) return false;
  if (value is int) return true;
  if (value is num) return value.toInt() == value;

  var s = value.toString();
  return int.tryParse(s) != null;
}