Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listen to real-time changes in Flutter SQFLite Database

I have a fully functional app created in Flutter. It uses sqflite plugin for storing data. I want to have a data change listener, which will update or refresh the data when new data is added or updated. How can I achieve this. I came across a sqflite helper plugin sqlcool but could not figure out a way to use it with my existing database in sqflite. Please help me.
Thanks.

like image 446
Rehmat Singh Gill Avatar asked Jan 19 '26 19:01

Rehmat Singh Gill


1 Answers

I also faced the same problem as yours, and ended up using Drift (Moor).

You can learn about it from its documentation -> https://drift.simonbinder.eu/docs/getting-started/

It's has similar features as Jetpack Room in Native Android Development. It also notifies when database changes using Flutter Stream API which you can easily observe (subscribe).

like image 191
Raheem Avatar answered Jan 21 '26 11:01

Raheem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!