toInt method

int toInt({
  1. int? defaultValue,
})

Retorna um int da string

defaultValue Caso o parse falhe, assume o valor indicado

Implementation

int toInt({int? defaultValue}) {
  // Faz um toDouble, pq se tentar dar um parse em um decimal direto pra int resulta em erro
  return this.toDouble(defaultValue: defaultValue?.toDouble() ?? 0.0).toInt();
}