Sunday, June 26, 2022

Flutter Getx Remove previous route | Difference between Get.toNamed, Get.offNamed, Get.offAllNamed

Hello everyone assalamualaikum here we'll take a look at the difference between get the two named get that off named and get that off all named first we'll go ahead and see how does get the two named works well here i am and if i click on this .

One i will go to the cart page cart page has a button and this is the button and if i click this button over here this layout gets called and here this condition and this method gets called which takes me to a new page once i click on this button and that's what .

I'll do okay yes it took me to a new page now if i want to go back yes i can go back so with get the two named you can go to a certain page and you can certainly go back to previous page okay now once again you click on this one .

So our previous page is cart page so we'll be able to go to cart page right now take a look how to use get dot off named right now over here let's change it to get off named okay all right so in this case we'll start this app again .

So that we understand what's going on so here i am so here i click on this cart icon it will take me to the cart page now if i click on this one it will take me to this new address route page but here in this case we are using a function .

Get off named so it will take me to new page but after going to new page i won't be able to return to this page it will take me to the earlier page let's go ahead and check it yes here i am now if you click on this one i won't be able to go go back to the cart page it will take me to the .

Previous previous page let's click on this one yes so this is our first page where we started to go to the cart page right so once again let's take a look you click on this one here we are we check out i'm a new page i'm on a new page and now if i click on this one i'll go back to the earlier to earlier .

Page so that's what happens so with get dot off named it removes the page the earlier page from memory now we'll take a look how to use get.off all named okay now let's take a look at get off all named okay now we'll start our page we'll start our app and .

Click over here now click on this now checkout so now if i want to go back i won't be able to go back because everything has been removed from memory and if you see yeah author apple has been deleted location repo has been deleted as well okay so with off all name it removes everything .

Earlier from the memory okay and with off named it just removes the previous page if you use get dot if you use get the two named and it keeps everything in the memory so it depends how you structure your app and how much memory wants to use thank you .

So much

RELATED ARTICLES

Most Popular