One of the biggest things that gets overlooked whenever people start a project is planning. I have noticed this on individual projects, as well as in the corporate environment. On individual projects, there might not be any planning at all, while in corporations there might just not be enough. So here I will give the minimal planning that I do for every flutter project that I start, but a similar planning method can be applied to any other OOP language. We’re going to go over figuring out your Use Cases (Features), Diagrams, and Folder Structure.

Use Cases

First things first, you need to figure out what the actual app is going to be, and what it is going to do. Without knowing that there can be no planning. I like to sketch out all the app screens that there will be, and think about how I would use it, and what features it will have. Then create a list of every single thing you want the app to accomplish. Not how you are going to accomplish it, but just the “what” it will accomplish. Let’s take any app that a user needs to log in, this use case should say what method they will use to log in (Email & Password, Google Log In, Fingerprint, etc). It should mention whether they will need to login every time they open the app. So one example for a Use Case here would be “User needs to login using email and password every time they open the app”. Now you need to go through the whole app, and make sure you write these down somewhere, and you can use it as a checklist of what needs to be accomplished when you’re writing the app.

Now if you’re working with a bigger team this is the part where I would go even deeper. Each one of those Use Cases should have a list of requirements. These requirements should dive deeper into what each Use Case is saying to do, and give technical “requirements” for what the software should do. From our previous example you need requirements for things like how many log in attempts they have, what errors to return if email doesn’t exist, what errors to return if password doesn’t match, etc.

Diagrams

Whenever working with multiple people, it’s very useful to be able to visually show them your ideas. And it will make it easier for others to understand what you are doing and thus be able to perform better on your team. But I also believe diagrams are essential for single person projects as well in terms of planning out the project and also having a reference when you forget a part of your code. For flutter, the minimum diagram you should do is a Widget Tree Diagram. Creating a widget tree diagram helps you think about how those Use Cases mentioned above are going to be implemented to code. For smaller projects just having a general widget tree to give you an idea about the layout is enough, but for larger projects with multiple team members I would have a general diagram for the screen navigation and everything, but then also break it down some more and have a diagram per screen. Then I think it would make sense to add some sequence diagrams to give an even better idea of what needs to be done.

Folder Structure

The last step is less time consuming then the first two, but once you know what you need, a specific folder structure needs to be defined. One of the worst things you can see on github, is projects where all the source files are in the lib directory. Things get confusing and hard to follow, hard to find what files you’re looking for and will confuse people like no other. Obviously if the app is tiny this is less important, but i would encourage creating a folder structure for even the smallest apps to get good practice. Each project will have its own folder structure, but this is a general structure I use for most of my apps:

Thinking and accomplishing these three things before starting on any project will save you and other programmers so much time, money, and rework later in the project. If you don’t do this already, I would recommend you give it a try and you will see how much smoother your projects go. If you are working with multiple people, you are probably doing some sort of planning, but I would recommend to focus on that and make sure you’re doing enough, and always be learning not just about code, but also different methods of planning and documenting as well. Hopefully this enables you to have more maintainable and well planned successful projects.

Happy Coding!

Instagram: @amateurcoder

Twitter: @tadaspetra