Skip to content

Query stream is not updated in UI isolate when changes made in another isolate #3414

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

You must be logged in to vote

The LazyDatabase wrapper on the foreground service isolate stands out. In drift, the stream query store responsible for distributing table updates is part of the DatabaseConnection class (which essentially wraps the QueryExecutor for running statements and the StreamQueryStore).

DriftIsolate.connect() gives you a DatabaseConnection, but using a LazyDatabase (which is only a standalone QueryExecutor) will essentially set up a local stream query store instead of using the one from the drift isolate.
In your case, the LazyDatabase wrapper isn't necessary at all since _initDatabase() is already async, just pass the dbConnection to the AppDBService constructor directly.

If you need _initDatabase

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Tumist76
Comment options

@simolus3
Comment options

Answer selected by Tumist76
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