flutterflutter-get

flutter get when to use GetX<Controller>, GetBuilder<Controller> or Obx()


As the title reads, there are a couple of ways to update state. When should I choose one over another?


Solution

  • There's no hard rules about this, but here's how I try to decide:

    Obx

    GetX

    GetBuilder

    Notes

    Under the hood, both Obx and GetX use streams, subscribing to controller observable variables change streams to know when to reactively rebuild.

    GetBuilder does not.

    GetX and GetBuilder both extend StatefulWidget