refactor: change singleton registrations to lazySingleton for improved performance

This commit is contained in:
Achintha Isuru
2026-03-09 15:01:18 -04:00
parent 46ca10933a
commit 7a5c130289
10 changed files with 41 additions and 41 deletions

View File

@@ -17,17 +17,17 @@ class FaqsModule extends Module {
@override
void binds(Injector i) {
// Repository
i.addSingleton<FaqsRepositoryInterface>(
i.addLazySingleton<FaqsRepositoryInterface>(
() => FaqsRepositoryImpl(),
);
// Use Cases
i.addSingleton(
i.addLazySingleton(
() => GetFaqsUseCase(
i<FaqsRepositoryInterface>(),
),
);
i.addSingleton(
i.addLazySingleton(
() => SearchFaqsUseCase(
i<FaqsRepositoryInterface>(),
),

View File

@@ -25,29 +25,29 @@ class PrivacySecurityModule extends Module {
@override
void binds(Injector i) {
// Repository
i.addSingleton<PrivacySettingsRepositoryInterface>(
i.addLazySingleton<PrivacySettingsRepositoryInterface>(
() => PrivacySettingsRepositoryImpl(
Modular.get<DataConnectService>(),
),
);
// Use Cases
i.addSingleton(
i.addLazySingleton(
() => GetProfileVisibilityUseCase(
i<PrivacySettingsRepositoryInterface>(),
),
);
i.addSingleton(
i.addLazySingleton(
() => UpdateProfileVisibilityUseCase(
i<PrivacySettingsRepositoryInterface>(),
),
);
i.addSingleton(
i.addLazySingleton(
() => GetTermsUseCase(
i<PrivacySettingsRepositoryInterface>(),
),
);
i.addSingleton(
i.addLazySingleton(
() => GetPrivacyPolicyUseCase(
i<PrivacySettingsRepositoryInterface>(),
),