Closed
Description
I have a Service that can be instantiated 2 different ways, by using two factories. however this class gets instantiated I need it to be a lazysingleton.
if I register a singleton like this:
locator.registerLazySingleton<Service>(() => Service());
then how to I instantiate it with a factory constructor later?
Service service = Service.fromJson(data);
needs to be instantiated somewhere in here, to get the singleton reference later on.
GetIt locator = GetIt.instance;
Service service = locator<Service>();
Metadata
Metadata
Assignees
Labels
No labels