getInt method

int getInt(
  1. String path
)

Reads an integer or parses a decimal integer string.

Implementation

int getInt(String path) {
  final value = _required(path);
  if (value is int) return value;
  if (value is String && RegExp(r'^[+-]?\d+$').hasMatch(value)) {
    final parsed = int.tryParse(value);
    if (parsed != null) return parsed;
  }
  throw const ConfigTypeException('Expected an integer.');
}