getInt static method

int getInt(
  1. Map<String, dynamic>? uiConfig,
  2. String key,
  3. int defaultValue
)

Get an integer value from uiConfig with a default

Implementation

static int getInt(
  Map<String, dynamic>? uiConfig,
  String key,
  int defaultValue,
) {
  if (uiConfig == null) return defaultValue;
  final value = uiConfig[key];
  if (value == null) return defaultValue;
  if (value is int) return value;
  if (value is double) return value.toInt();
  if (value is String) return int.tryParse(value) ?? defaultValue;
  return defaultValue;
}