addError method Null safety

void addError(
  1. String reason
)

Adds a validation error to the context.

A validation will fail if this method is invoked.

Implementation

void addError(String reason) {
  final p = property;
  if (p is ManagedRelationshipDescription) {
    errors.add(
        "${p.entity.name}.${p.name}.${p.destinationEntity.primaryKey}: $reason");
  } else {
    errors.add("${p!.entity.name}.${p.name}: $reason");
  }
}