relationshipFields property

Iterable<VariableElement> get relationshipFields

Implementation

Iterable<VariableElement> get relationshipFields {
  Map<String, VariableElement> map;

  map = {
    for (final field in fields)
      if (field.type.element is ClassElement &&
          field.isPublic &&
          (field.type.element as ClassElement).supertype != null &&
          relationshipTypeChecker.isSuperOf(field.type.element!))
        field.name: field,
    // also check freezed
    if (freezedConstructor != null)
      for (final param in freezedConstructor!.parameters)
        if (param.type.element != null &&
            relationshipTypeChecker.isSuperOf(param.type.element!))
          param.name: param,
  };

  return map.values.toList();
}