Skip to content

How to use notifyUpdates() and markTablesUpdated() and what is the difference between them? #1384

Answered by simolus3
ivanburlakov asked this question in Q&A
Discussion options

You must be logged in to vote

markTablesUpdated marks a table as updated (duh :D). This means that all active streams which might depend on that table will be getting updated. It takes a set of TableInfo objects. TableInfo is the base class for generated moor tables. You can obtain them using the database class:

final db = Provider.of<AppDatabase>(context, listen: false);
db.markTablesUpdated({db.stopwatches});

notifyUpdates is more precise: Instead of just describing the tables that changed, it can describe what kind of update has happened (insert, update or delete). This is used for stream updates in complex scenarios. For instance, consider

  • Two tables, a and b
  • A trigger inserting a row into b after a delete on a
  • A…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ivanburlakov
Comment options

Answer selected by ivanburlakov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants