toIntOrNull method

int? toIntOrNull()

Convert to int or null

Implementation

int? toIntOrNull() {
  if (this == null) return null;
  // Faz um toDouble, pq se tentar dar um parse em um decimal direto pra int resulta em erro
  return this.toDoubleOrNull()?.toInt();
}