operator [] method Null safety

dynamic operator [](
  1. String? propertyName
)

Retrieves a value by property name from backing.

Implementation

dynamic operator [](String? propertyName) {
  final prop = properties[propertyName];
  if (prop == null) {
    throw ArgumentError("Invalid property access for '${entity.name}'. "
        "Property '$propertyName' does not exist on '${entity.name}'.");
  }

  return backing.valueForProperty(prop);
}