...or better yet, define them in various places like each entity's Model or Repository.
My goal is to keep my database.dart file from becoming miles long because of ~6 CRUD functions per domain model, plus this also just fits the modular approach more IMO. I may just be missing an obvious pattern or something. Somewhat new to Flutter so please point me in the right direction.
Ta
I already have my Tables registered in separate files, so looking for something similar for Queries.
This can be achieved using DAOs in drift, view here.
More details regarding the solution:
queries.dart:Note: Make sure that the file name and the name provided in
partmatches. In this casequeries.dartmatches withpart 'queries.g.dart'.database.dart:dart run build_runner build: generates all the required code once.dart run build_runner watch: watches for changes in your sources and generates code with incremental rebuilds. This is suitable for development sessions.Bonus: You can also write SQL queries along with table schemas in
.driftfiles and map them to methods and call it like the same, view here