toInt method

int? toInt()

Converts a numeric string to an integer. Returns null if parsing fails or string is empty.

Implementation

int? toInt() {
  if (this == null) return null;
  return toDouble()?.toInt();
}