hasOwnProperty static method

bool hasOwnProperty(
  1. dynamic value,
  2. dynamic key
)

Implementation

static bool hasOwnProperty(dynamic value, dynamic key) {
  key = _normalizeProperty(key);
  if (value is Map) {
    return value.containsKey(key) ||
        getOwnPropertyDescriptor(value, key) != null;
  }
  if (value is List) {
    key = _normalizeIndexProperty(key);
    if (key is int) {
      return key >= 0 && key < value.length && !isArrayHole(value[key]);
    }
  }
  return false;
}