hasProperty static method

bool hasProperty(
  1. dynamic obj,
  2. String name
)

Checks if object has a property with specified name..

  • obj an object to introspect.
  • name a name of the property to check. Returns true if the object has the property and false if it doesn't.

Implementation

static bool hasProperty(obj, String name) {
  if (obj == null) throw Exception('Object cannot be null');
  // if (name == null) throw Exception('Property name cannot be null');

  var foundName = _findReadField(obj, name);

  return foundName != null;
}