intValue static method

int intValue(
  1. Map<String, Object?> src,
  2. String field, {
  3. int nullValue = 0,
})

Implementation

static int intValue(Map<String, Object?> src, String field, {int nullValue = 0,}) {
  Object? value = src[field];
  if (value.runtimeType == int) {
    // must be int
    return value as int;
  }
  if (value.runtimeType == Null) {
    // if value is null.
    return nullValue;
  }
  return nullValue;
}