Multiple Files For Each Screen

3 minutes
Share the link to this page
Copied
  Completed
You can separate each screen into individual files which are much easier to maintain.

Transcript

Hello, in this video, I am going to show you how to separate out no multiple screen into different files at the moment got this application for click on it, it navigates to the next screen and we can go back using iva buttons. But as you can imagine, we have multiple screens. And these are simple screens that have a lot of, you know, widgets, a lot of layout a lot of variables, it can get quite complex. So we want to separate it and abstract to that. To do that. It's really simple.

If we go to the lib folder, right click, go to new Dart file, and just create your second page. On the second page, you'll add the dot, dot dot extension from main, let's grab everything that's related to the second page and put it he just happens to be just that but he could be linking to other classes potentially. And we've put it into here who gave him some arrows. So what are these errors talking about? And the reason is, this will try and help. So it's because we haven't got a certain library imported to go to name.

If you look pretty much from the start the template had this quarter, so we need to copy that. And put up there that will fix all the errors. But there are still some more errors. And this one is because the second page class, which is this one right here, is no longer in the same file so we can't access it. It's simply the same problem as this, because this was in a different file. And we didn't include it could access but if we do import and we do second page dot dot, which is this file here, if it's in separate folders, you just, you know, essentially navigate to it put a semicolon now if we save and you confirm it is still working on say so one page.

Awesome. And for the first page, I'm going to walk through the epic page on the site, every page is amazing. So to show you, it's got the new updated version. Epic pages amazing iClicker second page is awesome. And we have it working the same way it is separated into foils. And that's really all there is that you need to know you can have as many folders as you want.

And it's good also to have a million files or limited files, but to separate the Content tab, so that way if something goes wrong, and let's say this is the homepage, this could be a settings page, you could have an account page, and there's something happening on the account page, you go to the 10 page dot dot. And there you go, you can now look at that code instead of having to look at hundreds of thousands of lines of code. You can reduce it Taking 50 or so long. That's it. If you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.