parseInt static method

int? parseInt(
  1. String value, {
  2. String? locale,
})

Parses value as an int, locale-aware. Returns null on failure.

Implementation

static int? parseInt(String value, {String? locale}) {
  try {
    final parsed = NumberFormat.decimalPattern(
      locale ?? _defaultLocale,
    ).parse(value);
    return parsed.toInt();
  } catch (_) {
    return null;
  }
}