FOLK Developers
Published in

FOLK Developers

Best Practices for Maintaining and Scaling Flutter Applications

Maintainable and Scalable codebase is arguably the most important consideration when building an app because it is essentially an insurance policy for your code.

The app needs to be scalable so that it can handle both the growing number of users and support new features without breaking the existing ones.

Let’s Start!
Amazing! isn’t it?

Your codebase will not survive if one person has all of the knowledge in their head. That information needs to be documented and built into the architecture so that every member on the team knows how to build new features in a way that they will not break the existing infrastructure.

Coding Standards

1. Naming Conventions (snake_case)

  • file_name.widget.dart
  • file_name.model.dart
  • file_name.util.dart

2. Folder Structure

  1. You can create specific folders for each and every module of your app in order to separate the development process, it’ll help in encountering the bugs and error’s more accurately and can be tackled before production.
  2. Inside of lib folder you can create a Core folder to store models, utils, widget components and helpers that can be used inside of any module across the application.
  3. Inside a specific module, you can create folders for models, core and services to be used inside of specific module and can be easily reusable inside of it.
  4. Following is the example of a folder structure with above mentioned principles.
Folder Structure example
Folder Structure example

3. Decoupling of views

They always say that Lazy developers are the best developers which happens to be true in many ways.

Architecture (Feature based)

Organize codebase by features


Inside of Features

  • Infrastructure features: maintains services, repositories, models, utils, validators, interfaces, … etc.
  • App features: maintains pages, widgets, styles, fonts, colors, …etc.

Steps for creating scalable codebase —

1. Scalable code is boring

Having a codebase that is predictable, easy to navigate, well tested and properly automated makes it boring. But pleasantly boring! And that’s great, teams love the feeling! It lets them focus on their real and business-related challenges without the distractions of other tasks.

  1. Stick to one state management library which is easy to understand by everyone working on the project. I’m biased about GetX so I prefer using it. Also, at the time of writing, it happens to be the most liked package on
  2. Writing clear documentation is helpful for every person working on the project as it promotes easier flow of work and module requirements.
  3. You can document the code in such a way that if you were to come back to the code in the future, you would be able to jump right back into it again. It will decrease the debugging time rapidly and help in increasing productivity.
  4. Your team should be on the same page when it comes to naming variables, functions, and classes. The codebase also should conform to pre-existing standards whenever possible, including following the Effective Dart style guide and using popular packages wherever it makes sense.

2. Try to reach 100% of code coverage in your tests

3. The Process of debugging should be easy

Easy Peasy!

4. Scalable code is composable






Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store