parseInt static method

int? parseInt(
  1. dynamic value
)

Implementation

static int? parseInt(dynamic value) {
  if (value == null) return null;

  if (value is int) {
    return value;
  } else if (value is String) {
    return int.tryParse(value);
  } else if (value is double) {
    return value.toInt();
  } else if (value is bool) {
    return value ? 1 : 0;
  }

  return null;
}