stringToInt function

int? stringToInt(
  1. String? value, [
  2. int? defaultValue
])

Implementation

int? stringToInt(String? value, [int? defaultValue]) {
  if (value == null) {
    return defaultValue;
  }

  return int.tryParse(value) ?? defaultValue;
}