DO NOT use push(), use pushReplacement() in the Navigator with routes

I wanted to tell you an anecdote that happened to me when I was creating the developmentLibre application here, which is the one you are seeing on the screen. The problem is right here with the DrawerComponent component, which is what allows me to navigate between the various pages. Right here was the problem for the list of all the courses that when I entered the details of some of them, for example this one, and then to go to the details of another course I had to click here and click here on all the courses, that is, you can see that it is always navigation goes through the DrawerComponent and I go to the other course here I was placing before was the Navigator.push(); What was the problem, with the Navigator.push() that what it does is enqueue each of the previous views, therefore every time you do the Navigator.push() here at the end if you went back it would return to the previous course and That is to say, if I needed 10 courses, I had those 10 courses queued and what was the problem, that when I did the dispose() in the courses widget, basically this property that we have here was mixed with the state of another previous one of another of the previous pages and with this obviously the application was going to crash when it went out of range when trying to consume any of the lists of the classes that I have here so pay close attention to that here. The important thing is to notice what your application really needs to To be able to function correctly in this case, for me it made no sense to have all these previous views queued since what it did was simply spend additional resources, which in this case the best we can do here was to place the Navigator.pushReplacement() so that always replace the previous page.

- Andrés Cruz

En español

Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.

!Courses from!

10$

On Udemy

There are 3d 02:32!


Udemy

!Courses from!

4$

In Academy

View courses

!Books from!

1$

See the books
¡Become an affiliate on Gumroad!