pinchbv / floor

The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications
https://pinchbv.github.io/floor/
Apache License 2.0
951 stars 190 forks source link

Remove noEntitiesDefined validation on build_runner generator #759

Closed lucasdidur closed 1 year ago

lucasdidur commented 1 year ago

It would be great to remove this validation in the generator. This would make it possible to configure templates without an entity configured in the initial floor configuration.

https://github.com/pinchbv/floor/blob/9967c32df262ce5faec2b0b7afc07dd5e3fcb862/floor_generator/lib/processor/database_processor.dart#L123

Generates this error on builder

[SEVERE] floor_generator on lib/core/database/app_database.dart (cached):  There are no entities added to the database annotation. package:template/core/database/app_database.dart:19:16    ╷ 19 │ abstract class AppDatabase extends FloorDatabase {}    │      
lucasdidur commented 1 year ago

Instead of throw an error, return a empty list.

dkaera commented 1 year ago

Hello @lucasdidur sorry, it's not clear for me. Without the entity declaration, the database processor cannot detect the connected DAO. This error is designed to help you avoid the situation when you forget to declare an entity.

SEGVeenstra commented 1 year ago

As far as I understand is this working as intended. I will close this issue.