[Flutter] 플러터 GetX Service


[Flutter] 플러터 GetX Service

Service 이 클래스는 GetxController와 같으며 동일한 수명 주기onInit(), onReady(), onClose()를 공유합니다. 그러나 그 안에는 '논리'가 없습니다. GetX Dependency Injection 시스템에 이 하위 클래스를 메모리에서 제거할 수 없음을 알립니다. main.dart void main() { initServices(); runApp(const MyApp()); } void initServices() async { // FCM Service 초기화 // permanent는 메모리에서 삭제되지 않고 고정되게 합니다. Get.put(FCMService(), permanent: true); } fcm_service.dart class FCMService extends GetxService { @override // ignore: unnecessary_overrides void onInit() async { .... } }...


#flutter #getx #service #플러터

원문링크 : [Flutter] 플러터 GetX Service