asInt static method

int asInt(
  1. Object? value
)

Implementation

static int asInt(Object? value) {
  if (value is int) return value;
  if (value is num) return value.toInt();
  return int.tryParse('$value') ?? 0;
}