toInt method

int? toInt({
  1. bool nullOnError = false,
})

Transform string to int type

Implementation

int? toInt({bool nullOnError = false}) {
  int? i = int.tryParse(this);
  if (i != null) return i;
  if (nullOnError) return null;
  throw FormatException('Can only acception double value');
}