Replies: 2 comments
-
|
Thanks for the detailed writeup! You’ve done a great job explaining your use case and walking through the code. It helps a lot. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Update: Just merge develop into main. Nested scopes are available now. Also added a devtools extension for easier use of ECS inspector. Check it out and tell me what you think. Cheers! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was tinkering some example project to use this (future) package, but I think I hit a limitation in it:
My use case is this:
I use an offline database eventually synced with a remote PostgreSQL database through PowerSync. PowerSync requires one database per user, so the database could only be initialized after the login and be disposed on logout.
So, I put this on my main.dart:
The main app shows a page depending on the auth state:
Perfect for this test. It works flawlessly (I admit it took some time for my two neurons to understand why I could not pass the credentials in the
LogInEvent- until I realize the credentials are actually hold by a component).Now, I wanted to simulate that case where I need to start up a database based on the authenticated user id, so, I did the next logical step, added a new scope wrapping my HomePage (my line of thought was: that scope will initialize stuff with
InitializeSystemand it will be disposed when the scope is unloaded (i.e.: when the SignOutEvent is triggered):(notice: in this example, there is only a new
CounterFeature, but here aDatabaseFeaturewould be created with initialization and disposal).But this is not what happened: this code made
SignOutEventunavailable (I think the new ECSScope is overriding the main.app one).So, two questions:
Should not ECSScope merge the features from the previous scope to the new one (same as
get_itdoes?)When that seconds
ECSScopeis unmounted by Flutter (example: when I sign out), all systems would be disposed (teardown)?The initialization seems to be sync (
void initialize()). I'm having trouble imagining how this particular database requirement fits in all of this (considering the features using in HomePage needs an initialized and opened database).Beta Was this translation helpful? Give feedback.
All reactions