toIntNullable method

int? toIntNullable()

safely get an int from a String

Implementation

int? toIntNullable() {
  if (isEmpty) {
    return null;
  }

  // https://api.flutter.dev/flutter/dart-core/int/tryParse.html
  return int.tryParse(this);
}