toIntSafe method

int toIntSafe({
  1. int defaultValue = 0,
})

Implementation

int toIntSafe({int defaultValue = 0}) {
  if (this == null) return defaultValue;
  return int.tryParse(this!.trim()) ?? defaultValue;
}