Skip to content

Commit

Permalink
Fix getEmbeds()
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikvdkaaden committed May 24, 2024
1 parent d25e530 commit 0a3c42c
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions floor_generator/lib/processor/database_processor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,19 @@ class DatabaseProcessor extends Processor<Database> {
final ClassElement databaseClassElement,
final Set<TypeConverter> typeConverters,
) {
final entities = _classElement
.getAnnotation(annotations.Database)
?.getField(AnnotationField.databaseEmbeds)
?.toListValue()
?.mapNotNull((object) => object.toTypeValue()?.element)
.whereType<ClassElement>()
.where(_isEmbed)
.map((classElement) => EmbedProcessor(
classElement,
typeConverters,
).process())
.toSet();

if (entities == null || entities.isEmpty) {
throw _processorError.noEntitiesDefined;
}

return entities;
return _classElement
.getAnnotation(annotations.Database)
?.getField(AnnotationField.databaseEmbeds)
?.toListValue()
?.mapNotNull((object) => object.toTypeValue()?.element)
.whereType<ClassElement>()
.where(_isEmbed)
.map((classElement) => EmbedProcessor(
classElement,
typeConverters,
).process())
.toSet() ??
{};
}

List<Entity> _getEntities(
Expand Down

0 comments on commit 0a3c42c

Please sign in to comment.