getInt method

int? getInt({
  1. required String key,
  2. String? defaultValue,
})

Implementation

int? getInt({required String key, String? defaultValue}) {
  dynamic value = getData(key: key, defaultValue: defaultValue);

  if (value is int) {
    return value;
  }

  if (value == null) {
    return null;
  }

  if (value is double) {
    return value.toInt();
  }

  return null;
}