Flutter - Get the improper use of a GetX has been detected
jiiii-hong
개발삽질
2022년 08월 24일
문제상황
플러터 GetX를 사용해서 개발중 아래와 같은 에러가 나왔다..
[Get] the improper use of a GetX has been detected.
You should only use GetX or Obx for the specific widget that will be updated.
If you are seeing this error, you probably did not insert any observable variables into GetX/Obx
or insert them outside the scope that GetX considers suitable for an update
(example: GetX => HeavyWidget => variableObservable).
If you need to update a parent widget and a child widget, wrap each one in an Obx/GetX.
이 문제로 한참을 찾았는데 알고보니 Obx로 감싼 위젯에서 관찰 가능한 변수(.obs로 생성된) 하나 이상 사용하지 않았을 때 발생하는 문제였다. 그냥 Obx로 감싼 위젯 안에서 관찰 가능한 변수를 하나 이상 사용해주면 된다.
'개발삽질' 카테고리의 다른 글
brew 설치중 xcode-select 설치 안됨 (0) | 2022.08.11 |
---|