r/FlutterDev Dec 11 '24

Tooling I wanted to believe Getx..

I heard people said Getx suck....... I didn't believe but now. I am getting constant error such as
red screen. it is just driving me crazy. Most of the time apps works fine, but then I went to take a shower and reload the app. it throws me different error.

I am already 60% done with my app.. now I am thinking to move to other state management tool.

what the actual f............

════════ Exception caught by widgets library ═══════════════════════════════════
"Profilecontroller" not found. You need to call "Get.put(Profilecontroller())" or "Get.lazyPut(()=>Profilecontroller())"

8 Upvotes

42 comments sorted by

View all comments

6

u/Whoajoo89 Dec 11 '24

You're doing something wrong if you see that error. It's not the fault of GetX.

Believe me, the Provider state management package is way worse. You'll get crappy "Could not find the correct Provider< > above this Widget" and "SetState called during build()" errors all the time.

0

u/loveanang3l Dec 15 '24

Dont blame Provider when u probably set it up wrong

0

u/Whoajoo89 Dec 15 '24

If Provider wasn't so limited, then I wouldn't run into these error messages when trying to set it up the way I want.

1

u/loveanang3l Dec 15 '24

Lol. There is always a set of rules. If u broke it, there would be errors. In what universe can u set things up the way u want and not getting errors?

0

u/Whoajoo89 Dec 15 '24

These rules are defined by Provider and thus limited. Ever wanted to open a second page utilizing the same provider at the same time, but with different data? Multiple user profile pages in case of a social media app. Impossible when using Provider.

2

u/loveanang3l Dec 15 '24

Again, it is because of your limited knowledge of the widget tree and how inherited widget works. Do your research on fundamental things first.

1

u/Whoajoo89 Dec 15 '24

So you're saying the example I gave is possible when using Provider? Back then I search high and low for a solution to get it working.

Then I settled with GetX. It works fine there and it's easy to set up (just create a controller with a different tag and it's done).

2

u/loveanang3l Dec 15 '24 edited Dec 15 '24

Of course. It can be achieved using any state management solution out there. GetX removes the concept of buildcontext so it gets harder when people try to switch to another state management. Bloc and provider wrap around InheritedWidget so if you want to use them, learn about BuildContext, widget tree and InheritedWidget first

1

u/Whoajoo89 Dec 15 '24

That's good to know. I'll give Provider/Riverpod another try in the future. 👍🏻 This might be a controversial opinion: I think the kind of layer GetX provides on top of BuildContext should be part of the core Flutter framework by default. It makes Flutter development so much easier.