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 148 forks source link

Questions about the registerFactory #351

Closed NicosNicolaou16 closed 12 months ago

NicosNicolaou16 commented 12 months ago

Hello,

I have two questions about the registerFactory. According to documentation the registerFactory creates every time a new instance when it calls.

1) Does registerFactory is singleton as well?

2) Does the previous registerFactory instance destroy when create a new one or keep the previous and the new instance as well?

escamoteur commented 12 months ago

The Factory isn't  Singleton, as it will create a new instance of the type it is registered with. What happens afterwards with the new instance is not further controlled by get_it Am 12. Dez. 2023, 19:39 +0100 schrieb Nicos Nicolaou @.***>:

Hello, I have two questions about the registerFactory. According to documentation the registerFactory creates every time a new instance when it calls.

  1. Does registerFactory is singleton as well?

  2. Does the previous registerFactory instance destroy when create a new one or keep the previous and the new instance as well?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

NicosNicolaou16 commented 12 months ago

Thank you for your answer! 🙏😀