fluttercommunity / get_it

Get It - Simple direct Service Locator that allows to decouple the interface from a concrete implementation and to access the concrete implementation from everywhere in your App. Maintainer: @escamoteur
https://pub.dev/packages/get_it
MIT License
1.36k stars 149 forks source link

Need Help: Dependency Problem with GetIt in vm:entry-point Pragma #357

Closed toe-lie closed 8 months ago

toe-lie commented 8 months ago

Hello,

Hope you're doing well! So, I've been using GetIt to handle dependencies in my project, and it's been smooth sailing. But now, I've run into a problem.

Here's the scoop: When I try to access a dependency within the vm:entry-point part, it throws an error, saying that SyncWorker isn't registered in GetIt. I've checked, and SyncWorker is definitely registered. Could it be something with the vm:entry-point causing this issue?

Any thoughts or tips on how to fix this would be really appreciated!

image

toe-lie commented 8 months ago

Just a quick update! I found out that the issue I was facing with GetIt and Workmanager stemmed from Workmanager running on a separate isolate from the main Flutter isolate. To fix it, I made sure to initialize all dependencies inside the Workmanager().executeTask() method.

Closing the question now. Have a great day!