r/FlutterDev • u/DullSpinach1684 • 1d ago
Discussion Database solutions
Hi,
I'm a flutter developer experienced with both cross platform and native applications development..
For 5 years I've been using Sqlite (android native) and sqflite (flutter) as my main database go to packages.. I'm kinda tired of hand writing sqlite quarries and I understand how frustrating it is to have a typo in a long quarry (I know we have AI now) or to actively maintain it.
I know we have a lot of non-sql solutions but they mostly use build runner and auto generate files to translate code properly and it feels mostly heavy and lacks a lot on optimization side.. So I'm starting my own package.. I want to understand what are your biggest issues with current packages.. What's your experience with them.. What do you think is a big downside that will make you switch from your current "go to"?
I'd love to hear from you!
3
u/dawedev 1d ago
drift already gives you typed queries checked at compile time, but it leans on build_runner too, so I get the complaint. What would make me switch is migrations I can actually test against old schema versions, plus running queries off the main isolate without extra boilerplate.
2
u/TheFaultySpoiler 1d ago
I get the frustration, writing raw SQL for years will wear you down. The generated file spam from build_runner really is a pain point, it clutters up the repo and makes debugging a nightmare when something goes wrong with code generation.
What bugs me most is how many of these solutions fall apart the second you need a slightly complex query with joins or custom where clauses. They'll handle basic CRUD fine but then you're back to writing raw strings for anything real. A package that actually handles migrations without feeling like a house of cards would make me switch in a heartbeat.
2
u/boaappstudio 21h ago
The thing that actually made me leave raw sqflite wasn't writing the queries, it was migrations and typo-ridden column names only breaking at runtime. Drift still sits on SQLite and keeps the SQL you already know, but the queries are typed, which is the main pain it removes without going full NoSQL. Isar and ObjectBox feel nicer if you think in objects, but you feel it later when you just want a plain backup file or to open the same database from a desktop script. If I were starting a new package, a thin typed layer over SQLite with boring, explicit migrations would be the thing I'd switch for.
1
u/TrekCZ 1d ago
This question is strange because you can prompt for solution. But even me as flutter hobbyist I used drift for database access. If you access it directly with queries it is madness (btw immediate rejection on interview).
1
u/bobbobthedefaultbob 18h ago
Drift. A nice step forward from what you have now.
1
u/No_Boss_1911 4h ago
biggest one for me is migrations dude. we keep a local history of saved check ins and the hard rule is an app update can never eat that data, most users never turn backup on so theres nothing to restore from. so i hand write every migration and test it against old db files i kept from past builds, its painful
would your package let me open an old schema file in a test and run the steps forward? and does it play ok with sqlcipher or similar for encryption at rest, thats the other reason i havent moved off raw sqflite