플러터 GetX에서 Dependency Injection 완벽 가이드 (초보자용)
1. Dependency Injection (DI)이란? Dependency Injection (DI)은 객체를 직접 생성하는 대신, 외부에서 필요한 객체를 제공하는 패턴입니다. 이를 통해 코드의 결합도를 낮추고 테스트 가능성을 높일 수 있습니다. 예시class UserService { String getUserName() { // ... }}class MyController { // UserService 객체를 직접 생성 UserService _userService = UserService(); void getUserInfo() { final userName = _userService.getUserName(); // ... }} 위 코드에서 MyController는 UserS..
2024.06.07