Very Good CLI - A Very Good Starter Project Generator for Flutter
Want to create a Scalable, Testable, and Maintainable Flutter Application from Day 1? Use Very Good CLI
Table of contents
Introduction
- As you create new Flutter projects, it can be hard to know how to structure your project. How do you structure your applications? Is there a standard way to use the prerequisites? What are the best practices?
- By using, Very Good CLI, you will be sure that the best practices for this kind of project are put in place for you.
- This leaves you free to focus on specific details for your specific application. It also guarantees that you have certain practices in places such as testing, linting, etc.
- Let's dive into the starter project created with the help of Very Good CLI and see what good things are set up for you.
Very Good CLI
- A Very Good Command Line Interface (CLI) is a tool created by the Very Good Venture team that generates a Flutter starter project for creating a production-level application with many features including like, testing, linting, state management, internationalization, null safety, CI, Logging, Built Flavors, and many more.
- Let's start with the installation part of this CLI.
Installation
- In order to use Very Good CLI, you need to activate the very_good_cli package from pub. dev.
- So, open up a terminal on your window and run the below command
dart pub global activate very_good_cli
- After the installation has finished you can run
very_good --version
to check that the installation has been done succesfully.
Creating a Starter Project with Very Good CLI
- In order to create a starter project using Very Good CLI run the below command in your terminal
very_good create my_project
- The project name is
my_project
in this case. You have the option of changing the name to match your requirements. - After all of the steps are completed, you'll notice a project created inside your chosen location.
- Let's have a look at the features featured in this project.
Features of Very Good CLI Starter Project
Folder Structure :
- The Folder Structure is the first thing that I liked the best in this Starter Project. The VGV team provided the folder structure, which they have used in the development of several production apps and is employed by firms like Betterment, Policygenius, Good Money, Hamilton, and others.
- This is the most critical factor I consider when selecting a starter project. Because as the project grows larger, maintaining the files and folders becomes increasingly difficult.
- The Feature Driven Approach has been selected for this project. This means that each app feature will be placed in its own folder, which will include both the business logic and the user interface for that feature.
- This is an excellent scalable application technique. The biggest benefit is that if you wish to eliminate a feature of the application, for an example
Settings
, you can just delete the settings feature folder and you're done. That's it.
Linting/ Analysis
- Another feature the starter project includes is Linting .
- Linting is a set of strict rules that a team follows in order to have a solid and unique way of coding. These rules help you to write better code, readability, and performance.
- Linter will warn you or give you an error if your code does not comply with the rules specified by linter and needs to be resolved for better code quality, readability, and performance.
State Management
- We all know that when it comes to developing complicated apps in Flutter, state management can be a pain. To make an app more maintainable, testable, and scalable, the VGV team has included the Bloc state management library in the starting project.
- If you're interested in learning more about Bloc state management, I've written a few articles on it. You can have a look at those.
Internationalization
- Internationalization is necessary since individuals do not always speak the language in which you expect them to speak. This means you'll need an app with no strings attached and the flexibility to switch between languages quickly.
- This starter project benefits from multi-language support straight away.
- All languages are stored in the 'I10n' subdirectory. files in JSON.
Null Saftey
- Sound Null Safety, which was formally introduced in a flutter, is another important feature.
- That means you won't have to waste time worrying about new exceptions that may arise during runtime in your app, and you'll be able to create the entire project on a lot more reliable and quicker platform, all while adhering to solid null safety guidelines.
Testing
- This is a starter project with complete coverage. This means that each and every line of code and functionality within the app is subjected to its own set of tests.
- We can just run the complete suite of tests whenever we add, delete, or refactor something to ensure that the application remains fully functioning.
Continuous Integration
- If you're working on a large team with multiple developers at the same time, and one of them submits a pull request to merge new changes with the main branch.
- The project will automatically verify it by running specific sets of tests and formatting rules, ensuring that the entire team is aware of the change.
- If something goes wrong during the implementation of the newly introduced modifications, you'll be able to comprehend flutter and dart errors much more quickly.
Logging
- We all know that flutter isn't often very clear about what went wrong with the application. As a result, every new project will include built-in extendable logging capabilities to record every potential exception and provide a more detailed explanation of why and where it occurred.
Built Flavours
- Another essential characteristic of the project's architecture that you may have noticed is that it includes multiple
main
files: one fordevelopment
, one forstaging
, and one forproduction
. - You may not have noticed this before, but there are three main stages to consider when developing an application professionally: first, you develop it in the development layer, then test and benchmark it in the staging layer, and finally, you release it to the public in the production layer.
- It's critical to keep these layers separate.
Cross-Platform Support
- Cross-platform support is available for this starter project. This means you'll be able to launch your app successfully on iOS, Android, and the web straight away.
Wrapping Up
- If you want to know more about Very Good Venture. Visit their website.
- Or you can also check the packages that they've made for Flutter and Dart on their pub.dev account.
- I hope you enjoyed and learned something from this article. If you have any feedback/queries, leave them in the comments.
Thank you for spending time reading this article. See you in the next article. Until then...