<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Isaias Cuvula on Medium]]></title>
        <description><![CDATA[Stories by Isaias Cuvula on Medium]]></description>
        <link>https://medium.com/@isaiascuvula?source=rss-9b5acbbe4876------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*moPoDiXZ-gga59_FILrCsg@2x.jpeg</url>
            <title>Stories by Isaias Cuvula on Medium</title>
            <link>https://medium.com/@isaiascuvula?source=rss-9b5acbbe4876------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 15:31:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isaiascuvula/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[State Management in Flutter Apps — An Overview]]></title>
            <link>https://isaiascuvula.medium.com/state-management-in-flutter-apps-an-overview-78e81ef37280?source=rss-9b5acbbe4876------2</link>
            <guid isPermaLink="false">https://medium.com/p/78e81ef37280</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[state-management]]></category>
            <dc:creator><![CDATA[Isaias Cuvula]]></dc:creator>
            <pubDate>Sun, 13 Aug 2023 13:49:35 GMT</pubDate>
            <atom:updated>2023-08-13T13:49:35.358Z</atom:updated>
            <content:encoded><![CDATA[<h3>State Management in Flutter Apps — An Overview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-9nI5orUWn6xcalg" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=medium&amp;utm_medium=referral">Kelly Sikkema</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Managing the state of an application is one of the most important and necessary processes in the life cycle of an application. With Flutter’s architecture, managing the state of your application becomes even more important.</p><p>In almost all apps, there is the concept of application state. every real-world app needs to handle its status at some point. As developers, we might start with one screen, but soon multiple screens with different features. These new screens might need to know what’s happening in the app. For example, in a shopping app, the cart screen should show what you picked from the catalog on the previous screen.</p><p>In Flutter, where everything is a ‘widget,’ things can get complex quickly. The widgets in these widget trees might need to share how the app is doing and pass this on to other widgets. So, it’s important to handle this widget-sharing thing or ‘State Management’ well. If not done right, the app could have problems when it grows.</p><p>When we talk about Flutter, the ways we structure the code and manage the state kind of mean the same thing. But using good code structure helps keep things organized.</p><p>The state is when a widget is active and stores its data in memory. Flutter divides app states into two types: ‘Ephemeral (local) State’ and ‘Application State.’</p><ul><li><strong>Ephemeral (local) state</strong> is about one widget when no other component in the widget tree needs to access a widget’s data—for example when a tab is selected inBottomNavigationBar</li><li><strong>Application state</strong> is about the whole app, for example when the user selects and adds an item to a shopping cart.</li></ul><p>You can learn more about different types of states on<a href="https://docs.flutter.dev/data-and-backend/state-mgmt/ephemeral-vs-app"> Flutter’s official page.</a></p><p>There are many ways to manage the app’s states in Flutter:</p><h3>StatefulWidget</h3><p>The most basic form of state management in Flutter is using the StatefulWidget class. This allows you to create a widget that has a mutable state. By extending StatefulWidget and implementing the associated State class, you can manage and update the state of your widget. This approach is suitable for simple applications or widgets that have their own isolated state.</p><p>Below is a basic case of ephemeral state management using StatefulWidget</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: CounterApp(),<br>    );<br>  }<br>}<br><br>class CounterApp extends StatefulWidget {<br>  @override<br>  _CounterAppState createState() =&gt; _CounterAppState();<br>}<br><br>class _CounterAppState extends State&lt;CounterApp&gt; {<br>  int _counter = 0;<br><br>  void _incrementCounter() {<br>    setState(() {<br>      _counter++;<br>    });<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Text(&#39;Ephemeral State Example&#39;),<br>      ),<br>      body: Center(<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: &lt;Widget&gt;[<br>            Text(<br>              &#39;Counter value:&#39;,<br>            ),<br>            Text(<br>              &#39;$_counter&#39;,<br>              style: TextStyle(fontSize: 36),<br>            ),<br>          ],<br>        ),<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: _incrementCounter,<br>        tooltip: &#39;Increment&#39;,<br>        child: Icon(Icons.add),<br>      ),<br>    );<br>  }<br>}</pre><p>In this case, the _counter is the local or ephemeral state. It&#39;s managed within the _CounterAppState class, which is a State object associated with the CounterApp widget. The _incrementCounter function updates the _counter state when the FloatingActionButton is pressed. The setState method is used to notify Flutter that the state has changed, and the UI needs to be rebuilt.</p><p>For more complex scenarios and larger applications, you might want to explore state management solutions like Provider, Bloc, or Riverpod.</p><h3>Provider</h3><p>Provider is a popular state management library in Flutter that makes it easy to manage and share state across your application. It follows the InheritedWidget pattern to propagate the state down the widget tree. Provider is known for its simplicity and flexibility, allowing you to easily update and access state from anywhere in your app.</p><h3>BLoC (Business Logic Component)</h3><p>BLoC is another popular state management pattern in Flutter. It separates the business logic from the UI, making your code more maintainable and testable. BLoC relies on streams and sinks to handle the flow of data. It provides a clear separation between the UI layer and the business logic layer, making it suitable for managing complex app state.</p><h3>Riverpod</h3><p>Riverpod is a modern state management library for Flutter, built on top of Provider. It offers a more intuitive and declarative way to manage state in your Flutter applications. Riverpod embraces the concept of “providers,” which are used to expose and consume state in your app. It provides a flexible and efficient way to manage both local and app (global) state.</p><h3>Redux</h3><p>Redux is a predictable state container for Flutter applications. It is based on the Redux pattern, which separates the state from the UI and provides a unidirectional data flow. Redux is known for its strict immutability and pure functions, making it easier to reason about the state changes in your app. It is suitable for large-scale applications that require a robust state management solution.</p><p>In addition to these approaches, there are many other state management solutions available for Flutter, such as MobX and GetX. The best approach to state management will depend on the specific needs of your app, but the key is to carefully consider the trade-offs between simplicity, scalability, and performance when selecting a solution.</p><p>Overall, effective state management is critical to building high-quality Flutter apps. By selecting an appropriate state management approach and carefully managing the app state, developers can ensure that their apps function correctly and efficiently.</p><h3>Conclusion</h3><p>State management is a crucial aspect of building applications in Flutter. Depending on the complexity and scale of your app, you can choose from various state management techniques and libraries. Whether it’s managing local state within a widget or handling global state across your app, Flutter provides a range of options to suit your needs. Experiment with different approaches and choose the one that best fits your application’s requirements. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78e81ef37280" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Clean Architecture]]></title>
            <link>https://isaiascuvula.medium.com/flutter-clean-architecture-2837583ed5c0?source=rss-9b5acbbe4876------2</link>
            <guid isPermaLink="false">https://medium.com/p/2837583ed5c0</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[code-structure]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Isaias Cuvula]]></dc:creator>
            <pubDate>Sun, 06 Aug 2023 12:39:08 GMT</pubDate>
            <atom:updated>2023-08-06T12:39:08.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4HH_jeTuNBbCZMgp" /><figcaption>Photo by <a href="https://unsplash.com/@lanceanderson?utm_source=medium&amp;utm_medium=referral">Lance Anderson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the world of mobile app development, building clean and maintainable code is crucial for long-term success. This is where Clean Architecture comes into play. Clean Architecture is a software design pattern that helps separate the concerns of different layers in an application, making it easier to understand, test, and modify. In this article, we will explore what Flutter Clean Architecture is, its benefits, and how to implement it in your Flutter projects.</p><h4>What is Clean Architecture?</h4><p>Clean Architecture is a software design pattern introduced by Robert C. Martin, also known as Uncle Bob. It promotes the separation of concerns and the dependency inversion principle, allowing for highly modular and testable code. The main idea behind Clean Architecture is to separate the business logic from the external dependencies, such as frameworks or databases.</p><h4>Why use Clean Architecture in Flutter?</h4><p>Flutter Clean Architecture is an architecture pattern that focuses on the separation of concerns, modularity, and maintainability.</p><p>Implementing Clean Architecture in your Flutter projects offers several benefits. Here are a few:</p><ol><li><strong>Modularity</strong>: Clean Architecture helps you break down your code into isolated and independent modules, making it easier to understand and maintain. Each module has a clear responsibility, which leads to better organization and scalability.</li><li><strong>Testability</strong>: By separating the business logic from the external dependencies, Clean Architecture allows for easy unit testing. You can test the core functionality of your app without worrying about the UI or other external factors.</li><li><strong>Flexibility</strong>: Clean Architecture makes it easier to modify or replace external dependencies. If you decide to switch to a different database or UI framework, you can do so without affecting the core business logic. This flexibility is essential for keeping your app up-to-date with the latest technologies.</li><li><strong>Code Reusability</strong>: With Clean Architecture, you can reuse the core business logic across multiple platforms. This means that if you decide to build a web or desktop version of your app in the future, you can leverage the same codebase and logic.</li></ol><h4>Implementing Clean Architecture in Flutter</h4><p>To implement Clean Architecture in your Flutter project, you can follow these general steps:</p><ol><li><strong>Identify the Layers</strong>: Identify the different layers in your application, such as presentation, domain, and data layers. The presentation layer handles the UI and user interaction, the domain layer contains the core business logic, and the data layer deals with external data sources.</li><li><strong>Define Dependencies</strong>: Define the dependencies between the layers. The domain layer should not depend on the data layer or the presentation layer. Instead, both the data and presentation layers should depend on the domain layer. This ensures that the core business logic remains independent of the implementation details.</li><li><strong>Implement Use Cases</strong>: Implement use cases in the domain layer. Use cases encapsulate the business logic and define the operations that can be performed in your application. Each use case should have a clear input and output, making it easy to test and understand.</li><li><strong>Use Dependency Injection</strong>: Use a dependency injection framework, such as: <a href="https://riverpod.dev/docs/getting_started"><strong><em>riverpod</em></strong></a><strong><em>, </em></strong><a href="https://pub.dev/packages/get_it"><strong><em>get_it</em></strong></a><strong><em>, or </em></strong><a href="https://pub.dev/packages/ioc_container"><strong><em>ioc_container</em></strong></a>, to manage the dependencies between the layers. This allows you to easily swap out implementations and provides better testability.</li><li><strong>Separate UI and Business Logic</strong>: Keep the UI code separate from the business logic. Use Flutter’s widget composition to build reusable UI components and keep the business logic in the domain layer.</li><li><strong>Write Unit Tests</strong>: Write unit tests for the business logic in the domain layer. This ensures that the core functionality of your app is working as expected and makes it easier to catch bugs or regressions.</li></ol><p>By following these steps, you can implement Clean Architecture in your Flutter projects and enjoy the benefits of clean and maintainable code.</p><p>Here is a basic structure for Flutter Clean Architecture that emphasizes scalability and testability:</p><pre><br>lib/<br>|-- config/<br>|   |-- routes/<br>|   |-- theme/<br>|-- data/<br>|   |-- datasources/<br>|   |   |-- remote/<br>|   |   |   |-- user/<br>|   |   |   |   |-- user_remote_data_source.dart<br>|   |   |   |   |-- user_remote_data_source_impl.dart<br>|   |   |   |-- post/<br>|   |   |   |   |-- post_remote_data_source.dart<br>|   |   |   |   |-- post_remote_data_source_impl.dart<br>|   |   |   |-- comment/<br>|   |   |   |   |-- comment_remote_data_source.dart<br>|   |   |   |   |-- comment_remote_data_source_impl.dart<br>|   |   |-- local/<br>|   |-- repositories/<br>|   |-- models/<br>|-- domain/<br>|   |-- entities/<br>|   |-- repositories/<br>|   |-- usecases/<br>|-- presentation/<br>|   |-- pages/<br>|   |-- widgets/<br>|   |-- blocs/providers<br>|   |-- utils/<br>|-- di/<br>|   |-- injection_container.dart<br>|-- main.dart</pre><p>Let’s break down each folder and its contents:</p><p><strong>data/</strong>: This folder contains all the implementation details of the application&#39;s data layer. It is further divided into:</p><ul><li><strong>datasources/</strong>: This folder contains the implementation of data sources, which can be either remote or local. For example, an API client to communicate with a backend server can be a remote data source, while a local database can be a local data source.</li><li><strong>repositories/</strong>: This folder contains the implementation of repositories, which act as a single source of truth for the data. Repositories provide an abstraction over the data sources and handle data retrieval and storage.</li><li><strong>models/</strong>: This folder contains the implementation of data models, which are used to represent the data entities of the application.</li></ul><p><strong>domain/</strong>: This folder contains the implementation of the application&#39;s domain layer. The <strong>Domain</strong> layer will contain our <strong>core business rules</strong> (entity) and <strong>application-specific business rules</strong> (use cases). It is further divided into:</p><ul><li><strong>entities/</strong>: This folder contains the implementation of domain entities, which represent the real-world objects of the application. Entities should be independent of any specific implementation detail.</li><li><strong>repositories/</strong>: This folder contains the interfaces of repositories. Interfaces define the contracts that the repositories must adhere to.</li><li><strong>usecases/</strong>: This folder contains the implementation of use cases, which define the business logic of the application. Use cases depend on the domain entities and the repository interfaces.</li></ul><p><strong>presentation/</strong>: This folder contains the implementation of the application&#39;s presentation layer. It is further divided into:</p><ul><li><strong>pages/</strong>: This folder contains the implementation of the pages or screens of the application.</li><li><strong>widgets/</strong>: This folder contains the implementation of reusable widgets that are used across different pages or screens.</li><li><strong>blocs/providers</strong>: This folder contains the implementation of BLoCs (Business Logic Components) or providers, which are responsible for managing the state of the application. BLoCs/providers depend on the use cases and provide the necessary data to the pages or screens.</li><li><strong>utils/</strong>: This folder contains helper classes or functions that are used across the presentation layer.</li></ul><p><strong>injection_container.dart</strong>: This file contains the dependency injection setup for the application. It defines how the different components of the application should be created and wired together.</p><p><strong>main.dart</strong>: This is the entry point of the application.</p><p>By following this structure, you can ensure that your codebase is scalable, testable, and maintainable. Additionally, you can apply various design patterns and principles such as SOLID, Dependency Injection, and Test-Driven Development (TDD) to further improve the quality of your codebase.</p><figure><img alt="Flutter clean architecture folder structure" src="https://cdn-images-1.medium.com/max/620/1*oZxY_6EyVwmen8J95q-63Q.png" /></figure><p>Flutter Clean Architecture is a powerful software design pattern that promotes modularity, testability, flexibility, and code reusability. By separating the concerns of different layers and following the principles of Clean Architecture, you can build robust and scalable Flutter applications. So give Clean Architecture a try in your next Flutter project and experience the benefits firsthand! Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2837583ed5c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create an Empty Flutter Project Without the Counter App Boilerplate Code]]></title>
            <link>https://isaiascuvula.medium.com/how-to-create-an-empty-flutter-project-without-the-counter-app-boilerplate-code-2c7878f861fd?source=rss-9b5acbbe4876------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c7878f861fd</guid>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter-project]]></category>
            <dc:creator><![CDATA[Isaias Cuvula]]></dc:creator>
            <pubDate>Sat, 05 Aug 2023 12:45:54 GMT</pubDate>
            <atom:updated>2023-08-05T12:45:54.235Z</atom:updated>
            <content:encoded><![CDATA[<p>Starting a new Flutter project is an essential part of any Flutter developer’s life. Usually, when we create a new project by running the “flutter create app_name” command or start a brand new project from Android Studio, we end up with a boilerplate code for a counter app like this:</p><figure><img alt="Flutter Counter App Boilerplate Code" src="https://cdn-images-1.medium.com/max/600/1*aIPm68obAU-DEfOwl0IfDQ.gif" /></figure><p>Running this project you will get this:</p><figure><img alt="Flutter counter app" src="https://cdn-images-1.medium.com/max/972/1*pW40eSlxwoTWzyK4fNhDxA.png" /></figure><p>So, the question is, how can we create an empty Flutter project? In this article, you will learn two ways to start an empty Flutter project without the boilerplate code from the counter app.</p><p>Before we get started, make sure you have already installed the Flutter SDK so we can smoothly proceed with the project. If you haven’t installed it yet, see the <a href="https://docs.flutter.dev/get-started/install"><strong>“<em>Get Started with Flutter</em>” guide on the official website</strong></a></p><p>Let’s get started</p><h3>Using Terminal</h3><p>Open VSCode or Android Studio terminal, or use your Mac terminal or Windows command line.</p><ol><li>Navigate to the desired location:</li></ol><p>On Mac:</p><pre>cd Desktop/DesiredLocation</pre><p>On Windows:</p><pre>cd C:\Users\&lt;Username&gt;\DesiredLocation</pre><p>2. After navigating to the desired location, run this command:</p><pre>flutter create -e your_app_name</pre><figure><img alt="new empty flutter project" src="https://cdn-images-1.medium.com/max/1024/1*fqUF3DTrSHj9NZtk_07wyw.png" /></figure><p>That’s it! Your new empty Flutter project will be created at the desired location.</p><p>To target a specific platform and keep your new Flutter project clean of any boilerplate code, run this command:</p><pre>flutter create -e your_app_name --platforms android,ios </pre><figure><img alt="Flutter new project folder structure" src="https://cdn-images-1.medium.com/max/735/1*uEK-7pwFq-wHEbO48ZHL2Q.png" /></figure><p>To specify the organization name, you can also run this:</p><pre>flutter create -e your_app_name --platforms android,ios --org “com.your_organization”</pre><p>With this command, you will have a new empty Flutter project without the boilerplate counter app code.</p><h3>Using Visual Studio Code</h3><ol><li>Open VSCode, click “View” located at the top, and select “<strong><em>Command Palette”</em></strong></li></ol><figure><img alt="view&gt;command palette on vscode" src="https://cdn-images-1.medium.com/max/735/1*S__WJ4qCAfvpqAobQJXogQ.png" /></figure><p>2. Search for “Flutter” and select: “Flutter New Project”</p><figure><img alt="command palette &gt; Flutter New Project on vscode" src="https://cdn-images-1.medium.com/max/735/1*_w0ab6ssrv-bIC9mXvq34Q.png" /></figure><p>3. Select the project template “Application (empty)”</p><figure><img alt="Choose “Application (empty)”" src="https://cdn-images-1.medium.com/max/734/1*YNwMFLGNfdb40ZQkI_aNww.png" /></figure><p>4. Choose the folder location</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*VFtni0UxIZZdKexc6QVP2g.png" /></figure><p>5. Enter a project name</p><figure><img alt="Enter project name on vscode" src="https://cdn-images-1.medium.com/max/731/1*BpfC8OTTu3JchXdsEUdcXw.png" /></figure><p>6. Click Enter</p><figure><img alt="new flutter project without counter app boilerplate code" src="https://cdn-images-1.medium.com/max/1024/1*fqUF3DTrSHj9NZtk_07wyw.png" /></figure><p>Running the project</p><pre>flutter run</pre><figure><img alt="new flutter project without counter app" src="https://cdn-images-1.medium.com/max/910/1*WDM08RIcLyg1_UHLKMqLyA.png" /></figure><p>Your new empty Flutter project without the counter app’s boilerplate code will be created at your desired location with the given name.</p><p>Congratulations! With this comprehensive guide, you now have all the tools to kickstart your Flutter journey and create new empty Flutter projects effortlessly. You’ve learned how to navigate the process of creating empty Flutter projects, avoiding the boilerplate code that comes with a counter app.</p><p>I hope you enjoyed this article and found it valuable in your Flutter development endeavors. If you’d like to stay updated with more insightful articles like this, feel free to follow me. I’m excited to share more tips, tricks, and in-depth tutorials to help you become a proficient Flutter developer.</p><p>Remember, practice makes perfect, so keep exploring and building amazing apps with Flutter. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c7878f861fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>