You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for this incredible package. I've been using it in many different projects and it makes developing on Flutter even more delightful.
Second, I've been dealing with this issue for about a year across multiple projects: whenever hot reloading on the web, I'll frequently but randomly encounter the following:
"Object/factory with type UserService is not registered inside GetIt. \n(Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;\nDid you forget to register it?)"
at Object.throw_ [as throw] (http://localhost:1234/dart_sdk.js:5061:11)
at Object.assertFailed (http://localhost:1234/dart_sdk.js:4986:15)
at get_it._GetItImplementation.new.[_findFactoryByNameAndType] (http://localhost:1234/packages/get_it/get_it.dart.lib.js:664:44)
at get_it._GetItImplementation.new.get (http://localhost:1234/packages/get_it/get_it.dart.lib.js:672:60)
at get_it._GetItImplementation.new.call (http://localhost:1234/packages/get_it/get_it.dart.lib.js:688:19)
at _RootZone.runUnaryGuarded (http://localhost:1234/dart_sdk.js:38448:11)
at _ControllerSubscription.new.[_sendData] (http://localhost:1234/dart_sdk.js:32328:22)
at _ControllerSubscription.new.[_add] (http://localhost:1234/dart_sdk.js:32277:26)
at _MultiStreamController.new.addSync (http://localhost:1234/dart_sdk.js:36275:56)
at _MultiControllerSink.new.add (http://localhost:1234/packages/rxdart/src/utils/forwarding_stream.dart.lib.js:29:32)
at _StartWithStreamSink.new.onData (http://localhost:1234/packages/rxdart/src/transformers/start_with.dart.lib.js:21:26)
at _RootZone.runUnaryGuarded (http://localhost:1234/dart_sdk.js:38448:11)
at _BroadcastSubscription.new.[_sendData] (http://localhost:1234/dart_sdk.js:32328:22)
at _DelayedData.new.perform (http://localhost:1234/dart_sdk.js:35633:28)
at _StreamImplEvents.new.handleNext (http://localhost:1234/dart_sdk.js:35737:15)
at async._AsyncCallbackEntry.new.callback (http://localhost:1234/dart_sdk.js:35498:16)
at Object._microtaskLoop (http://localhost:1234/dart_sdk.js:38778:13)
at _startMicrotaskLoop (http://localhost:1234/dart_sdk.js:38784:13)
at http://localhost:1234/dart_sdk.js:34519:9
I never encounter this otherwise, but it makes developing on the web with get_it more painful than it should be. Hot restarting/refreshing the page always fixes it. I have no idea what's making this happen. The registration pattern is standard:
@escamoteur Happens in debug mode only. GetIt.I<> does not appear to fix it.
We can make it happen somewhat frequently just by testing futures in main() and hot restarting. It feels very much like a framework-level race condition on hot restarts. The services reference each other and are registered via registerSingletonAsync which feels related, based on the race condition nature and the fact we've never experienced it on non-async singletons.
@escamoteur Happens in debug mode only. GetIt.I<> does not appear to fix it.
We can make it happen pretty reliably with futures just in main(). It feels very much like a framework-level race condition on hot restarts. The services are registered async via registerSingletonAsync which feels like it's related.
Timer.periodic(
const Duration(seconds: 5),
(_) => sl<SomeService>().doSomething(),
);
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you were mentioned.Message ID: ***@***.***>
First, thanks for this incredible package. I've been using it in many different projects and it makes developing on Flutter even more delightful.
Second, I've been dealing with this issue for about a year across multiple projects: whenever hot reloading on the web, I'll frequently but randomly encounter the following:
I never encounter this otherwise, but it makes developing on the web with get_it more painful than it should be. Hot restarting/refreshing the page always fixes it. I have no idea what's making this happen. The registration pattern is standard:
The text was updated successfully, but these errors were encountered: