Data Streams (Watcher)
A Watcher is a use case for streaming data that continuously emits a Left Event
(error) or Right Event
(data) whenever our stream emits an error or new data, respectively.
The Left Event
, in our case, is one of the Failure objects we previously created, whereas the Right Event
is a list of Note entities on our app. Every time a new note is created, updated or deleted, our Watcher will emit a new Right Event
with an updated list of the most recent notes we have.
To create a Watcher
use case for streaming a list of our most recent note entries, under the note_app/modules/domain/lib/note/use_cases/
directory, create a file called watch_note_entries.dart
:
Last updated