getx icon indicating copy to clipboard operation
getx copied to clipboard

GetX 5

Open jonataslaw opened this issue 2 years ago • 191 comments

I think I have failed to be conservative.

GetX basically hasn't changed since its first version (only the RxTypes have changed due to Flutter updates), and I've been trying to keep breaks to a minimum for each update, after all, this is one of the things I like (or liked) the most in using a framework, not having to tinker with its code for a long time.

However, version 5 became a headache. We were migrating the api to navigator 2 completely without ANY break, this is insane. I had to keep a bunch of code I didn't want to maintain compatibility.

However, the truth is that Flutter has matured over the years, and so have I, and there are many things that I just don't see any sense in anymore.

GetWidget, for example, is a widget that prevented Flutter from updating a widget for performance. This was identical to React's PureComponent, not present in Flutter, however, it complicated the api, and brought more bugs than benefits, simply because it was impossible to modify it. With current applications that have dynamic themes, this has become useless.

Also, it seems that GetX users have come to demonize BuildContext, and well, that might have been my fault, after all, that was GetX's description. However, our role was to provide parallel dependency management approaches, not based on BuildContext, but that didn't mean we stopped using it. Today there are people who use Get.width within widgets, which is a headache, since it does not receive dynamic updates, for that there is context.width, however, despite this being in the documentation, this seems to be ignored by part of the users.

That way, I ended up pushing an update forward, just out of fear, fear of having to refactor my projects, fear of causing too many breakings, and the project went a long time without updates.

However, I think we can be better, I think we can have a solid, modern foundation (the current one was written 4 years ago), and so I think we're going to have some changes.

I created this issue to share all the changes I'm going to make in version 5, to serve as a guide in case something breaks.

This does NOT mean that GetX 5 will be full of breaking changes, just that it will have small breaking changes, like every major package update.

jonataslaw avatar Aug 26 '23 21:08 jonataslaw

  1. GetWidget. GetWidget will NOT prevent further widget updates. Perhaps it will be merged with GetView, and perhaps it will have one of the following functions:
  • Auto track of updates: Not sure yet, but maybe this will be added
  • Scopped Widget: It can create a scope to pass a copy of your controller to your children. This controller can be accessed through the BuildContext.
  1. Nested Navigation: Previously we used onGenerateRoute to use nested navigation. This won't work since version 5 uses Navigator 2. We'll use RouterOutlet instead.

  2. Whoever uses the "change" immutable api will have some breaks. RxStatus for example will cease to exist.

  3. Bindings will change, instead of an empty method you will have to return a List<Binding>. This will allow you to inject the dependency with a scope. Why that? Well, if you have a "ProfileController" controller, and a feed where you can endlessly browse through countless profiles, you'll need something similar. I think the current approach is too "hacking", and you have to use tags to generate dependencies. This usually brings a headache, so let's change.

If you don't use any of the above, the chances that you don't have breaking are high.

Note: We will probably split the package into smaller packages for those who only want to use part of the package. The Get package will continue with all the code, but there will be other smaller packages with only part of the implementation. Each resource will communicate with the others through Middlewares. Ex:

Navigation will trigger events. Dependency injection can listen to these events to decide when to delete a controller.

State management and dependency injection cannot be separated, because the latter depends on the former at any time. However the routing, connection with the api (get_connect), and the animations api, may not be part of the scope of many projects, so let's insert it in GetX, but allow people to use GetX's state manager without they also. Obviously, everything will work better together (since the automatic deletion of controllers integrates well with the routes api), but if someone wants to use it in a different way, that's fine.

jonataslaw avatar Aug 26 '23 21:08 jonataslaw

all the best to you.

micodev avatar Aug 26 '23 22:08 micodev

Version management is very confusing, i can't even find the properly branch or tag or commit id of version 4.6.5.

laeo avatar Aug 27 '23 06:08 laeo

i appreciate your time and effort to provide significant solutions but i have a question for you are you working on this alone ??

shehabhy1 avatar Aug 27 '23 08:08 shehabhy1

GetX has already saved a lot of time, and now it's time to use that time to embrace change.

pye52 avatar Aug 27 '23 09:08 pye52

Thank you, for giving a update and wish you all the best

ramees-nuhman avatar Aug 27 '23 14:08 ramees-nuhman

Thanks for the update and the effort to make this package evolve in the good direction. Please prepare a migration documentation for the change() api, bindings and navigation. Thank you @jonataslaw

loic-hamdi avatar Aug 27 '23 17:08 loic-hamdi

Thanks for trying to keep this great package up to date. We really appreciate your effort.

KorayLiman avatar Aug 27 '23 20:08 KorayLiman

Thanks for trying to keep this great package up to date. We really appreciate your effort.

han1548772930 avatar Aug 28 '23 08:08 han1548772930

Keep up the great work. Your package help me a lot

sannchesda avatar Aug 28 '23 08:08 sannchesda

you're rock bro

skylastn avatar Aug 28 '23 09:08 skylastn

go bro....fuck all haters getx is the best in flutter world! support getx forever!

the6nnoo avatar Aug 28 '23 09:08 the6nnoo

getx is the best in flutter world! support getx forever!
Thank you so much for all you do.

LoveHeiZhu avatar Aug 28 '23 11:08 LoveHeiZhu

I'm finally able to resolve this issue, thank you very much. https://github.com/jonataslaw/getx/discussions/2878

synstin avatar Aug 28 '23 11:08 synstin

I'm finally able to resolve this issue, thank you very much. #2878

Please tell how you managed that.

ramees-nuhman avatar Aug 28 '23 11:08 ramees-nuhman

you're rock bro

zhangyutao12 avatar Aug 28 '23 15:08 zhangyutao12

@jonataslaw you are the very good and intelligent programmer in the Flutter world I support getx forever ❤️ All the best @jonataslaw

alok2811 avatar Aug 28 '23 18:08 alok2811

I don't see the update on pub.dev. Is the update not available yet?

nugrahaz avatar Aug 28 '23 19:08 nugrahaz

separating multiple packages is a really good decision

zhangruiyu avatar Aug 29 '23 02:08 zhangruiyu

Great to hear that GetX 5 is now on track, our applications are using GetX from start, and it's so easy to new members to catch and understand our codebase because of the simple of this framework, that's why we use GetX over Riverpod, BloC, Provider,...

Linkadi98 avatar Aug 29 '23 11:08 Linkadi98

when will the new version be published?

seljad avatar Aug 30 '23 08:08 seljad

when will the new version be published?

Next year i guess

gauravmehta13 avatar Aug 30 '23 10:08 gauravmehta13

Hahaha It's almost ready to go, but I'm making sure it works perfectly in my projects in production. If it doesn't get any problems within 1-3 days, it will be pushed to pub.dev.

I'd rather be the guinea pig than push an update and you guys be mine, if something breaks I can fix it quickly.

jonataslaw avatar Aug 31 '23 01:08 jonataslaw

Hahaha

It's almost ready to go, but I'm making sure it works perfectly in my projects in production. If it doesn't get any problems within 1-3 days, it will be pushed to pub.dev.

I'd rather be the guinea pig than push an update and you guys be mine, if something breaks I can fix it quickly.

Noice 🥳

Linkadi98 avatar Aug 31 '23 01:08 Linkadi98

Hahaha It's almost ready to go, but I'm making sure it works perfectly in my projects in production. If it doesn't get any problems within 1-3 days, it will be pushed to pub.dev.

I'd rather be the guinea pig than push an update and you guys be mine, if something breaks I can fix it quickly.

Waiting for new challanges ✌️

alok2811 avatar Aug 31 '23 01:08 alok2811

Hahaha It's almost ready to go, but I'm making sure it works perfectly in my projects in production. If it doesn't get any problems within 1-3 days, it will be pushed to pub.dev.

I'd rather be the guinea pig than push an update and you guys be mine, if something breaks I can fix it quickly.

great

acquytrenthienduong avatar Aug 31 '23 02:08 acquytrenthienduong

哈哈哈 它几乎准备好了,但我确保它在我的生产项目中完美运行。如果1-3天内没有出现任何问题,它将被推送到pub.dev。

我宁愿当小白鼠,也不愿推送更新,你们就是我的,如果出现问题我可以快速修复。

Excited for the update.

han1548772930 avatar Aug 31 '23 05:08 han1548772930

Hahaha It's almost ready to go, but I'm making sure it works perfectly in my projects in production. If it doesn't get any problems within 1-3 days, it will be pushed to pub.dev.

I'd rather be the guinea pig than push an update and you guys be mine, if something breaks I can fix it quickly.

Hahaha It's almost ready to go, but I'm making sure it works perfectly in my projects in production. If it doesn't get any problems within 1-3 days, it will be pushed to pub.dev.

I'd rather be the guinea pig than push an update and you guys be mine, if something breaks I can fix it quickly.

go go go

zhangyutao12 avatar Aug 31 '23 05:08 zhangyutao12

Hahaha It's almost ready to go, but I'm making sure it works perfectly in my projects in production. If it doesn't get any problems within 1-3 days, it will be pushed to pub.dev.

I'd rather be the guinea pig than push an update and you guys be mine, if something breaks I can fix it quickly.

the best news today

seljad avatar Aug 31 '23 07:08 seljad

day after day~wait for you

qiuyan81 avatar Sep 02 '23 09:09 qiuyan81