Drift + Flutter Bloc + Clean Architecture: Todo App, how to manage streams through flutter bloc?

183 views Asked by At

I was just trying to create a simple Todo Application using Drift for SQL storage and Flutter Bloc for state management, following clean architecture to get a quick grasp on how things work with drift.

And I noticed that Drift offers access to database streams directly with .watch() function on any database object.

My question is, do I setup .watch() stream from drift database following the usual clean architecture steps and emit the same stream again to the bloc builders from the bloc, is that bad practice? And even if I do that, how should I do it?

Or,

Do I directly use StreamBuilders in the presentation layer and access the drift database .watch() streams to update data.

I'm a bit confuse on which is the better approach. Thanks in advance!

0

There are 0 answers