getProperty static method

dynamic getProperty(
  1. dynamic obj,
  2. String? name
)

Recursively gets value of object or its subobjects property specified by its name.

The object can be a user defined object, map or array. The property name correspondently must be object property, map key or array index.

  • obj an object to read property from.
  • name a name of the property to get. Returns the property value or null if property doesn't exist or introspection failed.

Implementation

static dynamic getProperty(obj, String? name) {
  if (obj == null || name == null) return null;

  var names = name.split('.');
  if (name == '' || names.isEmpty) return null;

  return RecursiveObjectReader._performGetProperty(obj, names, 0);
}