If you've ever felt the weight of the repetitive and time-consuming process of setting up a new project – creating a new project, configuring the basic project architecture, and adding frameworks and libraries – you're not alone.
At Onix, our Flutter development team has traversed this well-trodden path, accumulating rich experiences and, importantly, crafting a set of tried-and-true tools that have become the backbone of our projects. However, we've always sought ways to push the boundaries of efficiency, especially during the critical initial stages of project development.
Today, we're thrilled to unveil Onix's Project Generator – a tool designed to reduce the time and effort required to set up a Flutter project.
In this article, we delve into the intricacies of our solution, consider how it works, and demonstrate how this tool saves time and elevates your Flutter development experience.
Table of contents
The Project Generator is designed to create a project with a pre-established file structure, architecture, various base classes, and utilities. With just a few clicks, this allows for quickly adding components to the project, such as screens and data components. And this will be much faster than doing it manually in the IDE.
Let’s consider the main features the Flutter project generator contains.
Creating a new project with clean architecture
Onix's Project Generator significantly simplifies the initial steps of project creation by offering a clean architecture foundation. This feature provides developers with a robust starting point, including predefined frameworks and libraries that our experienced team at Onix has carefully curated. When initiating a new project, developers can input essential details such as project name, BundleId, and other options, creating a well-structured foundation for efficient development.
Configurability and component management
Developers can fine-tune their projects by enabling or disabling specific components based on project requirements. This level of control ensures that each project is tailored to the unique needs of the development team. Whether it's selecting flavors, generating signing keys, integrating with Sonar, enabling GraphQL, choosing a navigation library, handling localization, or managing theming, developers can easily configure these settings with precision.
Efficient screen stub generation with BLoC
Saving developers from the repetitive task of manually setting up screens and their associated business logic, the Project Generator introduces a seamless process for adding screen stubs. With just a few clicks, developers can pre-configure screens and generate corresponding Business Logic Components (BLoCs). This feature saves time and ensures consistency across different screens within the project, fostering a standardized and efficient development workflow.
Streamlined data layer configuration using Swagger URLs
Configuring the data layer is a crucial aspect of any Flutter project. Onix's Project Generator takes this further by allowing developers to leverage Swagger URLs. By providing the URL of a Swagger file, developers can automate the generation of various data layer components, including sources, request/response models, mappers, entities, and repositories. This feature accelerates the project setup process and promotes consistency and accuracy in the data layer implementation.
Editing settings of previously created projects
Projects often undergo changes or updates. The Project Generator recognizes this need and can edit the settings of previously created projects. This feature ensures that developers can adapt existing projects generated through the tool to evolving requirements. Whether adding new screens, modifying data components, or updating Swagger URLs, the Project Generator provides a seamless and efficient way to make adjustments, promoting flexibility and agility in project management.
Onix's Project Generator collectively contributes to a more efficient, customizable, and consistent Flutter development experience. These features are designed to empower developers, save valuable time, and elevate the quality and speed of project setup and initiation.
Onix's Project Generator is more than a development tool; it's a strategic asset for businesses aiming to streamline their Flutter projects.
Let's explore the distinct pros of Onix project generator brings to the table, offering efficiency, consistency, and a competitive edge in the fast-paced app development world.
Time savings and rapid development
The automated generation of project structures, architecture, and code components eliminates repetitive manual tasks. This time-saving advantage translates into faster project initiation, allowing businesses to meet tight deadlines and deliver results promptly.
Read also: How to Accelerate Software Development
Consistency across projects
The tool's ability to generate predefined frameworks, libraries, and architecture ensures that all projects adhere to a consistent development approach. This uniformity simplifies collaboration among development teams, enhances code readability, and facilitates maintenance, ultimately contributing to a more efficient development ecosystem.
Enhanced developer productivity
Setting up a Flutter project with the Onix project generator becomes more efficient. The Project Generator eliminates developers from manual, time-consuming configurations by automating routine project setup steps. This enables them to allocate more time and energy to strategic aspects of development, such as code optimization, feature implementation, and project refinement.
Adaptability to changing requirements
In response to evolving needs, the tool allows developers to seamlessly add new screens, modify data components, or update Swagger URLs. This adaptability ensures that businesses respond agilely to shifting priorities, ultimately contributing to enhanced project management and customer satisfaction.
Code quality assurance
The tool generates fully functional classes, models, sources, and repositories, ensuring the project starts with a solid foundation. This accelerates development and contributes to a robust codebase, reducing the likelihood of errors and enhancing long-term maintainability.
Optimized resource utilization
The tool's automation capabilities reduce the need for manual intervention in project setup. This, in turn, optimizes resource utilization, allowing developers to allocate their skills and expertise to tasks that demand creative problem-solving and strategic thinking.
By leveraging the advantages outlined above, businesses can optimize their development processes, respond agilely to changing requirements, and deliver high-quality projects quickly and precisely.
Onix's Project Generator provides a streamlined and efficient way to create projects with predefined structures and configurations. Let's dive into the step-by-step process of creating a project using Onix's Project Generator:
1. Selecting project parameters
Upon launching the Project Generator, the initial screen prompts you to choose the project type. To create a new project, select "Generate new projects." We'll explore the alternative option later in this guide.
2. Entering project details
The next step involves entering fundamental project details. Input the project name and package name or BundleId. This straightforward step sets the foundation for your new Flutter project.
3. Choosing project platforms
On the subsequent screen, select the platforms for your project. This ensures the project is configured to your target platforms, optimizing the development environment.
4. Configuring project details
Delve deeper into project configuration on the next screen, where you can fine-tune various settings. Let's explore each configuration item:
- Enable to configure the project with flavors.
- Dev and prod flavors are created automatically.
- Add additional flavors by entering their names in the input field.
- Utilize the flavorizer utility for flavor creation.
Generate signing key:
- Opt to add Android signing key generation to the project for enhanced security.
- Choose to add Sonar configuration files to the project for improved code quality monitoring.
- Integrate GraphQL by adding necessary classes to the project.
- Select the type of navigation library (GoRouter/AutoRouter) for seamless navigation within the app.
- Choose the type of localization for the project.
- Enable or disable using the theme_tailor library to define the application theme.
5. Adding screen stubs
This step allows you to add screen stubs to your project, saving valuable time and ensuring consistency across different screens. You can pre-configure screens and associate them with a navigator selected in a previous step.
- Click the "Add screen" button.
- Enter the screen name (without the word “Screen”).
- Choose whether you want BLoC or Cubit for the screen.
- Click "Continue" when finished, or proceed without adding screens.
6. Fetching styles from Figma file
This process lets you retrieve styles and colors from your Figma file and generate corresponding styles in your application theme.
- Input the Figma file ID.
- Provide the Figma token.
- Click on "Get styles."
Once done, you'll have a preview showcasing all the parsed Figma styles.
7. Configuring data layer using Swagger URLs
At this stage, you can paste a Swagger JSON link. This is particularly helpful when backend development is complete, and you have a Swagger file at your disposal. The generator can automatically create sources, request/response models, mappers, entities, and repositories based on the Swagger file.
- Paste the Swagger URL or click "Continue" to proceed without using a Swagger URL.
If you input a Swagger URL, you'll observe the parsed contents of the Swagger file. This will provide a preview of your project's data layer, including the creation of models, sources, repositories, and mappers based on the information in the Swagger file.
Additionally, you can add components manually, including models and their respective fields, and perform other customization options.
8. Reviewing and generating the project
The final step involves a comprehensive review of your project configuration. Ensure all details are correct, and when satisfied, click "Generate Project."
9. Completion and project generation
A window with logs describing the generation process will appear. Relax, grab a coffee, and wait for the generator to complete its magic (usually within 2-4 minutes). Once done, a completion message will appear with buttons to open the project in Android Studio or close the generation window.
Congratulations! You've successfully created a Flutter project with Onix's Project Generator, significantly reducing the time and effort typically required for project setup.
Now it's time to explore the heart of your project – the generated code.
Upon opening the project in your preferred Integrated Development Environment (IDE), you'll find a well-organized and ready-to-use Flutter project.
Well-organized and ready-to-use Flutter project
The data layer components were generated using a Swagger URL, showcasing the tool's ability to automate the creation of crucial elements like models, sources, and repositories.
Data layer components were generated using a Swagger URL
The generated code reflects a Clean Architecture approach, providing a solid foundation for development. But what sets this apart is not just the structure. It's the inclusion of real, functional code that goes beyond mere stubs.
The generated models, sources, and repositories are not placeholders or stubs – they are fully functional classes, implementing essential aspects such as API requests, parsing, and mapping. This means that right from the start, your project is equipped with production-ready components, saving you valuable time and effort.
However, it's crucial to acknowledge the significant role played by the Swagger file in shaping the generated code. The structure of the Swagger file, including component naming and organization, directly influences the quality and accuracy of the resulting code. The Project Generator is designed to interpret the Swagger file and generate code accordingly, ensuring a direct correlation between what you see in Swagger and what gets produced.
The generated project code
With Onix's Project Generator, you're not just saving time – you're elevating the standards of your Flutter project development.
Onix's Project Generator streamlines the initial project setup and offers a reliable solution for making essential modifications. Whether adding screens, introducing new data components, or updating Swagger URLs, the Project Generator ensures that your Flutter project remains agile and adaptable to changing requirements.
Imagine a scenario where you've previously created a project using Onix's Project Generator, and subsequently, global changes are needed. The API information may have evolved, requiring updates to response objects or modifications to the data layer. This is precisely where the Project Generator proves its versatility and agility.
Options for modification:
1. Adding new screens
Open the existing project in the Project Generator. Navigate to the screen modification section. Add new screens seamlessly, ensuring a harmonious integration with the current project structure.
2. Introducing new data components
If the project demands additional data components, such as models, sources, or repositories, the Project Generator provides a straightforward mechanism for their inclusion. The tool ensures that these new components seamlessly integrate with the existing data layer, maintaining consistency and efficiency.
3. Updating swagger URLs
In situations where changes in the API information necessitate an update to Swagger URLs, the Project Generator offers a hassle-free solution. Simply access the Swagger configuration section, input the revised URL, and let the tool automatically generate the updated components based on the new Swagger information.
Onix's Project Generator stands as a valuable tool offering a comprehensive solution to the repetitive challenges of project setup. By significantly reducing the time and effort required to initiate a Flutter project, the tool empowers developers to focus on building innovative features and delivering high-quality applications. For technical decision-makers overseeing Flutter development teams and organizations engaged in Flutter app development, embracing the Onix Project Generator can improve productivity, consistency, and project success.
- What is Onix's Project Generator, and why is it important for Flutter developers?
Onix's Project Generator is a specialized tool designed to streamline and expedite the process of setting up new Flutter projects. Tailored for Flutter developers, this tool offers a range of features that automate the creation of project structures, architecture, and code components, significantly reducing the time and effort traditionally required for project initialization.
- Is this tool suitable for both beginner and experienced Flutter developers?
Yes, Onix's Project Generator is designed to be suitable for both beginner and experienced Flutter developers. This tool will be helpful for everyone working with Clean Architecture and BLoC.
- Can I use the Project Generator for existing projects, or is it only for creating new ones?
The Project Generator developed by Onix is versatile and can be used to create and modify new Flutter projects. While it excels at streamlining the initial project setup process, it also offers efficient tools for modifying projects created through the generator.
If you've already created a project using Onix's Project Generator and later need to make modifications, such as adding new screens, introducing new data components, or updating Swagger URLs, the tool provides a seamless solution. This adaptability makes it a valuable asset not only during the project's inception but also throughout its lifecycle as requirements evolve.
- Can I customize the generated code or components to fit my project requirements?
You can configure the main parameters of the project, such as the name, ID, the use of specific libraries, etc. Then, the project opens in your IDE, and you can edit it at your discretion.