usingUsing Dart in the client part of a web app where iI have an application manager that contains a ListList
of application instances and references to services that are used by each application as in the following diagram
asAs you can see the application manager is a singleton, so are the services that it contains which are used by all apps, to me it makes sense because
- iI need to have only one instance of the ApplicationManager and each service
- easierEasier to access services without the need to pass references
- iI need to preserve the state of each service
- almostAlmost all services have a cache
iI found ways to avoid having the services as singletons which is by making them private to the library which is a feature in dart, so iI initialize the services only once from the application manager, but iI can't make the ApplicationsManager private because its at the top most level of the library, iI would appreciate your thoughts for a way to avoid having the application manager as a singelton.