getProperty static method
Gets value of object property specified by its name.
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) throw Exception('Object cannot be null');
// if (name == null) throw Exception('Property name cannot be null');
var foundName = _findReadField(obj, name);
if (foundName != null) {
try {
var im = reflect(obj);
return im.getField(foundName).reflectee;
} catch (e) {
// Ignore exceptions
}
}
return null;
}