refactor: change singleton registrations to lazy singleton for improved performance
This commit is contained in:
@@ -666,17 +666,17 @@ class StaffConnectorRepositoryImpl implements StaffConnectorRepository {
|
|||||||
class StaffMainModule extends Module {
|
class StaffMainModule extends Module {
|
||||||
@override
|
@override
|
||||||
void binds(Injector i) {
|
void binds(Injector i) {
|
||||||
i.addSingleton<StaffConnectorRepository>(
|
i.addLazySingleton<StaffConnectorRepository>(
|
||||||
StaffConnectorRepositoryImpl.new,
|
StaffConnectorRepositoryImpl.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
i.addSingleton(
|
i.addLazySingleton(
|
||||||
() => GetProfileCompletionUseCase(
|
() => GetProfileCompletionUseCase(
|
||||||
repository: i.get<StaffConnectorRepository>(),
|
repository: i.get<StaffConnectorRepository>(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
i.addSingleton(
|
i.addLazySingleton(
|
||||||
() => StaffMainCubit(
|
() => StaffMainCubit(
|
||||||
getProfileCompletionUsecase: i.get(),
|
getProfileCompletionUsecase: i.get(),
|
||||||
),
|
),
|
||||||
@@ -772,7 +772,7 @@ StateError: Cannot emit new states after calling close
|
|||||||
|
|
||||||
```dart
|
```dart
|
||||||
// ✅ GOOD: Singleton registration
|
// ✅ GOOD: Singleton registration
|
||||||
i.addSingleton<ProfileCubit>(
|
i.addLazySingleton<ProfileCubit>(
|
||||||
() => ProfileCubit(useCase1, useCase2),
|
() => ProfileCubit(useCase1, useCase2),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
18
.github/PULL_REQUEST_TEMPLATE.md
vendored
18
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
<!-- Provide a clear and concise description of your changes -->
|
<!-- Provide a clear and concise description of your changes -->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔗 Related Issues
|
||||||
|
|
||||||
|
<!-- Link any related issues using #issue_number -->
|
||||||
|
|
||||||
|
Closes #
|
||||||
|
Related to #
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -33,15 +41,6 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🔗 Related Issues
|
|
||||||
|
|
||||||
<!-- Link any related issues using #issue_number -->
|
|
||||||
|
|
||||||
Closes #
|
|
||||||
Related to #
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ✅ Testing
|
## ✅ Testing
|
||||||
|
|
||||||
<!-- Describe how you tested these changes -->
|
<!-- Describe how you tested these changes -->
|
||||||
@@ -93,7 +92,6 @@ Related to #
|
|||||||
|
|
||||||
- [ ] Code quality and readability
|
- [ ] Code quality and readability
|
||||||
- [ ] Design patterns follow project conventions
|
- [ ] Design patterns follow project conventions
|
||||||
- [ ] Test coverage is adequate
|
|
||||||
- [ ] Performance implications reviewed
|
- [ ] Performance implications reviewed
|
||||||
- [ ] Security concerns addressed
|
- [ ] Security concerns addressed
|
||||||
- [ ] Documentation is complete
|
- [ ] Documentation is complete
|
||||||
|
|||||||
Reference in New Issue
Block a user