Flutter报错:[Get] the improper use of a GetX has been detected. You should only use GetX or Obx

[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.

Crude error code:

 

Correct code:

 

Error analysis: Obx and GetX listeners are only applicable to .obs variables or variables defined by Rx. This error will be reported when used in ordinary dart variables or methods.

Guess you like

Origin blog.csdn.net/zww986736788/article/details/132127421