toIntOrNull method

int? toIntOrNull()

Returns the value of this number as an int or null if can not be parsed.

Implementation

int? toIntOrNull() {
  if (this == null) return null;
  return int.tryParse(this!);
}