Osama Asif Image
Osama Asif
September 2020

Some Things to Take Care of When Developing Large Apps in Flutter

Before diving into the nitty-gritty of developing and maintaining large scale applications in Flutter, let’s first talk about what Flutter is. You can skip this section if you’re already a Flutter developer and move to the developing bigger apps section which follows the introduction about flutter.

mobile phone


Quoting directly from it’s website, “Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.”

It is an amazing framework which allows us to develop cross platform applications by writing code only once and then with some minor configuration changes we can port and run our apps on other platforms as well. However, that’s not only the major benefit of Flutter. It also allows developers to create beautiful, intuitive and brand oriented user interfaces with less code and more customization. How does the framework do that? Well, Flutter gives you the control of drawing and rendering of every pixel on the screen. In short, it’s pretty cool.

Developing Bigger Apps

After playing around with Flutter for sometime you’ll feel confident enough to take the responsibility to get involved in an actual large scale project either building a project from scratch and make changes in an existing one. You might feel a little bit overwhelmed and that’s completely normal. The key here is to make a plan and first and then dive into your IDE. To make the planning process more useful for now and down the road I would like to share the some lessons we learned along the way when developing apps in Flutter.

Choose an Architecture

When developing a real application it is necessary to choose an architecture. This is where things get difficult as there are many solutions available for state management and architecture. Just choose the state management framework which works best for you. There are a lot of options available but my favourite ones and the options which have been around for quite some time are

Both these solutions have been around for a long time and they are very mature now. Bloc comes with a bit of a steep learning curve in the beginning but after that it is a very dependable state management solution to work with.

Stick to the Architecture

So you chose an architecture great! Now to make the most of that and avoid unnecessary confusions down the road stick to the best practices of the framework. That will help you to avoid many common issues and bugs which might crawl into your codebase without a hint. Best practices exist because other developers were once in the same situations you’re going through and came up with a good solution which solved many common problems. Therefore you can use that already established knowledge and build on that with confidence. Staying close to the recommended architecture will turn the project in a good direction in many different ways which might not be visible instantly but at some point in future when you’ll open the code to make some changes or add a new feature you’ll be proud and thankful to yourself for following the recommended practises.

Don’t Sleep on Exception Handling

Flutter increases developer efficiency and speed. It allows developers to quickly write code which will get the job done faster and that’s a win. However, Flutter does not by default point out where your code might run into exceptions while executing. Exceptions are pointed out at runtime only if they occur. Coming from the Android development world where Android studio would yell at me to take care of exceptions that can occur in Java, Flutter’s silence was a big relief. Jokes apart, it is a necessary practise to handle exceptions. It is important to give the users of the application proper feedback that an exception has occurred and they might need to wait a few minutes and then retry. It is always undesirable if the application just hangs or crashes when an exception occurs. So be a little crazy and test your code in all likely undesirable circumstances and when exceptions occur take care of them using try catch and responsibly giving a notification or dialog to the user.

Osama Asif Image
Osama Asif

Osama Asif is Engineering Lead at ENOU. He talks about software development and often shares his practices and views about emerging technologies.

Continue reading...

Let's build something great together

Would you like to start a new project or work on an idea with us? We’d be happy to collaborate.

Tell us everything