Flutter Mobile Application Using Domain Driven Design

M Safwan Yasin
4 min readFeb 19, 2024

--

🚀 Tale Tuner, my winter project using Domain Driven Design! 📱✨

During my summer internship, I worked on mobile application development using Flutter. Despite having prior development experience with Flutter, I was oblivious to the design architectures that could be employed in mobile app development to maximize their scalability and efficiency. Unfortunately, the short duration of my internship limited my exposure to the complete development process, leaving me eager to learn more about Domain Driven Design. Therefore, in my winter break, I took on the task of creating a mobile application to deepen my knowledge of DDD.

🏗️ My key takeaways from Domain Driven Design:

Domain Driven Design streamlines the app development process by compartmentalizing it into four main layers — Presentation, Application, Domain, and Infrastructure. Each layer provides services to only the layer above. This modular approach enhances scalability, maintainability, and collaboration. Here’s a brief breakdown of each layer:

1. Presentation Layer:

- This layer is where the external beauty resides. It is responsible for the user interface and user experience, translating data from the application layer into a user-friendly format.

1. Application Layer:

- Handles user interactions and communicates with the Domain layer. To employ this I used cubits — a subset of the Flutter bloc package — that handle state management by using methods to emit new states.

- Orchestrates the flow of data and actions. No matter where the data would originate from — the backend service, or from a user input, the first destination would always be the application layer.

2. Domain Layer:

- The heart of the application, containing business logic and rule.The modularity of this layer allows for changes in other layers without impacting the core functionality, enabling flexible adaptations. Therefore, if you wish to migrate from Firebase to another backend service, you wouldn’t have to restructure the entire application.

- Value validated objects, value failures and interfaces for repositories are the key components of this layer.

3. Infrastructure Layer:

- Manages external concerns such as data storage, APIs, and third-party integrations, thus ensuring the domain layer’s independence.

- This layer would include the implementation to the repositories and data transfer objects that carry data from the external sources to the domain layer.

🌐 Optimization and Efficiency:

Implementing DDD also helped me hugely in optimizing the app. The clear separation of concerns allowed for targeted improvements in specific layers, without affecting the entire application. This not only streamlines development but also enhances the overall performance of the app.

🎨 From Design to Reality:

Since I wanted this to be a learning experience, I worked on the entire development process myself. I started by creating a UI design in Figma. During the design, I also came across RIve, an amazing app that lets you create animations that can be used inside your Flutter applications. Rive enabled me to create animated icons for my navigation bar, a live background, and also breathed some life into my logo

📚 Now coming to the application itself. Here are the key Features:

- Wishlist and Reading List management for books. I implemented a search function that allowed users to search for all the books present on the Google Books database, and then give them the option to add it to their wish list or reading list.

- Integrated the Gemini API to create unique stories based on prompts. It allowed users to input some parameters such as the genre, setting etc and then create a story based upon them.

- Firebase for secure authentication and data storage.

🚀 Ready to Contribute:

This project not only refined my Flutter skills but also showcased my commitment to mastering advanced architectural principles like DDD. I’m eager to bring my expertise to a dynamic team, leveraging my skills to contribute to innovative and efficient app development.

💻 Open Invitation:

For those interested in taking a look at my code and details of this project, feel free to drop a comment! I’m more than willing to share my insights and collaborate with fellow enthusiasts. Let’s learn and grow together!

#FlutterDev #MobileAppDevelopment #DomainDrivenDesign #Firebase #GeminiAPI #TechInnovation #DeveloperLife #NewOpportunities #TechTalent #HiringNow #FlutterDeveloper #SoftwareEngineering #OpenSourceCollaboration

--

--