androidflutterdartfloor

flutter floor floor_generator error: There are no entities added to the database annotation


I have created the floor entities and DAOs but when I run

flutter packages pub run build_runner build --delete-conflicting-outputs  

I got the following error

There are no entities added to the database annotation. package:storeapp/database/myAppDatabase.dart:74:16 ╷ 74 │ abstract class MyAppDatabase extends FloorDatabase {} │

but I added the entities as following

@Database(version: 1, entities: [
  Account,
  AccountingClass,
  LocalizedProperty,
  PointOfSale,
  StoreCurrencyMapping,
  User,
  InventoryTransaction,
  JournalVoucher,
  JournalVoucherEntry,
  JournalVoucherEntryDetail,
  BaseObject,
  StoreCustomer,
  StoreEmployee,
  StoreVendor,
  Store,
  Warehouse,
  Category,
  Product,
  ProductCategory,
  StoreProductMapping,
  Order
])

Solution

  • I was importing a file as

    import 'models/baseObjects/Warehouse.dart';
    

    the capital in the file name, when I change it to exactly the file name as

    import 'models/baseObjects/warehouse.dart';
    

    it works fine.