Junior — Middle
Is it possible to place a Context object inside a UseCase in application architecture?
sobes.tech AI
Answer from AI
In Android architecture, it is recommended to avoid storing the Context object inside a UseCase to prevent creating tight coupling with the platform and to avoid memory leaks. A UseCase should be platform-independent and contain only business logic. If Context is necessary, it is better to pass it as a method parameter or use abstractions (such as repositories) that encapsulate work with Context. Therefore, storing Context inside a UseCase is not recommended.