<?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 Aditya Mhatre on Medium]]></title>
        <description><![CDATA[Stories by Aditya Mhatre on Medium]]></description>
        <link>https://medium.com/@adityagmhatre?source=rss-e588bc4bedd0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TvYGg7rim8pLfZ0DNvAttA.png</url>
            <title>Stories by Aditya Mhatre on Medium</title>
            <link>https://medium.com/@adityagmhatre?source=rss-e588bc4bedd0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:40:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityagmhatre/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[Dot Shorthands in Flutter & Dart ]]></title>
            <link>https://blog.stackademic.com/dot-shorthands-in-flutter-dart-434963e234e4?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/434963e234e4</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[enum]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Sat, 13 Jun 2026 07:49:32 GMT</pubDate>
            <atom:updated>2026-06-18T13:42:19.326Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*2Yyw8R9XkORowOPgqBB5cQ.png" /></figure><h3>Introduction 🌅</h3><p>Dart has evolved significantly over the years, bringing many features that make code more expressive and concise. One such feature is <strong>Dot Shorthands</strong>.</p><p>Dot shorthands provide a cleaner way to access static members and enum values without repeatedly specifying the type name. This improves readability and reduces unnecessary verbosity in our code.</p><p>In this article, let’s explore dot shorthands and understand how they can simplify our Flutter and Dart applications.</p><h3>What are Dot Shorthands?</h3><p>Dot shorthands allow us to omit the type name when the context already makes it obvious.</p><pre>enum ThemeMode { light, dark }<br><br>// Previously, we had to write:<br>ThemeMode mode = ThemeMode.dark;<br><br>// With dot shorthands, we can write:<br>ThemeMode mode = .dark;</pre><p>Here, Dart automatically infers that .dark belongs to ThemeMode.</p><h3>Why do we need Dot Shorthands?</h3><p>Before this feature, we often had to repeat the type name multiple times.</p><p>Consider the following example:</p><pre>BorderRadius borderRadius = BorderRadius.circular(16);<br>ThemeMode mode = ThemeMode.dark;</pre><p>Repeating the class or enum name can make the code verbose.</p><p>Dot shorthands reduce this repetition and make the code easier to read.</p><h3>Using Dot Shorthands with Enums</h3><p>Enums are one of the most common use cases.</p><pre>enum UserRole { admin, user, guest }<br><br>// // Previously, we had to write:<br>UserRole role = UserRole.admin;<br>UserRole currentRole = UserRole.guest;<br><br>// With dot shorthands, we can write:<br>UserRole role = .admin;<br>UserRole currentRole = .guest;</pre><p>Since the variable type is already known, Dart can infer the enum type automatically.</p><h3>Using Dot Shorthands in Switch Statements</h3><p>Suppose we have:</p><pre>enum OrderStatus { pending, shipped, delivered }</pre><h4>Without dot shorthand:</h4><pre>switch (status) {<br>  case OrderStatus.pending:<br>    print(&#39;Pending&#39;);<br>  case OrderStatus.shipped:<br>    print(&#39;Shipped&#39;);<br>  case OrderStatus.delivered:<br>    print(&#39;Delivered&#39;);<br>}</pre><h4>With dot shorthand:</h4><pre>switch (status) {<br>  case .pending:<br>    print(&#39;Pending&#39;);<br>  case .shipped:<br>    print(&#39;Shipped&#39;);<br>  case .delivered:<br>    print(&#39;Delivered&#39;);<br>}</pre><p>This makes switch statements cleaner and more readable.</p><h3>Using Dot Shorthands with Static Members</h3><pre>// Without dot shorthand:<br>double size = double.parse(&#39;80&#39;);<br>Duration duration = Duration.zero;<br><br>// With dot shorthand:<br>double size = .parse(&#39;80&#39;);<br>Duration duration = .zero;</pre><p>Dart infers that the value belongs to the expected type context.</p><h3>Constructor Invocation with Dot Shorthands</h3><pre>// Without dot shorthand:<br>final DateTime now = DateTime.now();<br><br>// With dot shorthand:<br>final DateTime now = .now();</pre><p>The type context tells Dart which constructor should be used.</p><h3>Advantages of Dot Shorthands</h3><h4>Less Boilerplate</h4><p>Removes repetitive type names from the code.</p><h4>Improved Readability</h4><p>The focus stays on the value rather than the type.</p><h4>Cleaner Switch Statements</h4><p>Pattern matching and switch expressions become more concise.</p><h4>Better Developer Experience</h4><p>Writing less code makes development faster and reduces clutter.</p><h3>Things to Keep in Mind</h3><p>Dot shorthands work only when Dart can infer the type from the surrounding context.</p><p><strong>For example:</strong></p><pre>// Works perfectly<br>ThemeMode mode = .dark;<br><br>// Will produce an error because<br>// Dart cannot determine which type .dark belongs to<br>var mode = .dark; ❌</pre><h3>Conclusion 🌇</h3><p>Dot shorthands are a small but powerful addition to Dart. They help eliminate unnecessary repetition and make code cleaner and easier to read.</p><p>Whether you’re working with enums, static members, constructor tear-offs, or pattern matching, dot shorthands can make your Flutter and Dart code more expressive and maintainable.</p><p>As Dart continues to evolve, features like these contribute to a more pleasant and productive developer experience. 🚀</p><ul><li><a href="https://blog.stackademic.com/building-robust-data-sources-in-clean-architecture-for-flutter-e4c0833f17ed">Building Robust Data Sources in Clean Architecture for Flutter</a></li><li><a href="https://blog.stackademic.com/use-cases-in-clean-architecture-for-flutter-bridge-the-gap-f6d8a181f874">Use Cases in Clean Architecture for Flutter: Bridge the Gap</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=434963e234e4" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/dot-shorthands-in-flutter-dart-434963e234e4">Dot Shorthands in Flutter &amp; Dart 🚀</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Robust Data Sources in Clean Architecture for Flutter]]></title>
            <link>https://blog.stackademic.com/building-robust-data-sources-in-clean-architecture-for-flutter-e4c0833f17ed?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4c0833f17ed</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[datasource]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Fri, 18 Oct 2024 16:17:17 GMT</pubDate>
            <atom:updated>2024-10-21T03:17:25.808Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*wRpHVA7RdG4k3XFMcL3Ogw.png" /></figure><h3>Introduction 🌅</h3><p>In Clean Architecture, the separation of concerns across different layers helps maintain a scalable, maintainable, and testable codebase. One of the key layers in this architecture is the <strong>Data Layer</strong>, which is responsible for interacting with external data sources like REST APIs, databases, or local storage.</p><p>Within the <strong>Data Layer</strong>, <strong>Data Sources</strong> play a pivotal role by fetching data from these external systems and passing it to the <strong>Repository</strong>. The Repository then interacts with the <strong>Domain Layer</strong> by providing domain-specific objects. Understanding how to structure and implement Data Sources in a Flutter application following Clean Architecture is crucial for creating efficient, flexible, and maintainable applications.</p><h3>Role of Data Sources in Clean Architecture 👩🏻‍🏫</h3><p>In Clean Architecture, the <strong>Data Layer</strong> is responsible for handling data access, regardless of whether the data comes from a local database, a REST API, or any other external source. <strong>Data Sources</strong> are abstractions that manage the communication with these external sources and provide a structured interface for the <strong>Repository</strong> to interact with.</p><h4>Responsibilities of a Data Source:</h4><ol><li><strong>Data Fetching</strong>: Retrieve data from external systems (e.g., APIs, databases).</li><li><strong>Data Saving</strong>: Save data to external systems (e.g., saving to local storage or pushing to an API).</li><li><strong>Transformation</strong>: Convert raw data (JSON, database entries) into <strong>Models</strong> that the <strong>Repository</strong> can work with.</li><li><strong>Abstraction</strong>: Provide a layer of abstraction over the actual data sources, keeping the rest of the application unaware of where the data is coming from.</li></ol><h4>Key Points About Data Sources:</h4><ul><li>Data Sources are <strong>purely data-driven</strong> and do not include business logic.</li><li>They should remain <strong>independent</strong> of the <strong>Domain Layer</strong> and <strong>UI Layer</strong> to ensure separation of concerns.</li><li><strong>Repositories</strong> delegate data operations to Data Sources and convert them into <strong>Entities</strong> (business objects).</li></ul><h3>Types of Data Sources 🎭</h3><p>In a typical Flutter app using Clean Architecture, there are two common types of Data Sources:</p><ol><li><strong>Remote Data Source</strong>: Handles data from APIs, cloud services, or remote systems.</li><li><strong>Local Data Source</strong>: Deals with data stored locally, such as in SQLite, shared preferences, or other forms of persistent storage.</li></ol><h4>Example Workflow:</h4><ul><li>A <strong>Remote Data Source</strong> fetches data from an API and passes the raw data to the <strong>Repository</strong>.</li><li>The <strong>Repository</strong> converts the raw data into <strong>Entities</strong> and passes it to the <strong>Use Cases</strong> in the <strong>Domain Layer</strong>.</li><li>In cases where the app operates offline, a <strong>Local Data Source</strong> can provide cached or stored data to the <strong>Repository</strong>.</li></ul><h3>Implementing Data Sources in Flutter 🛠️</h3><p>Let’s walk through the implementation of <strong>Remote</strong> and <strong>Local Data Sources</strong> in a Flutter app that manages tasks. We’ll integrate them with the <strong>Repository</strong> to demonstrate how data flows from the external source to the <strong>Domain Layer</strong>.</p><h4>Step 1: Define the Task Model (Data Layer)</h4><p>Before creating Data Sources, we define a <strong>Model</strong> that represents the structure of the data as it exists in the data layer. This structure often mirrors the external data format (such as JSON from an API).</p><pre>class TaskModel {<br>  final String id;<br>  final String title;<br>  final String description;<br>  final bool isCompleted;<br><br>  TaskModel({<br>    required this.id,<br>    required this.title,<br>    required this.description,<br>    required this.isCompleted,<br>  });<br><br>  // Convert from JSON to TaskModel<br>  factory TaskModel.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return TaskModel(<br>      id: json[&#39;id&#39;],<br>      title: json[&#39;title&#39;],<br>      description: json[&#39;description&#39;],<br>      isCompleted: json[&#39;isCompleted&#39;],<br>    );<br>  }<br><br>  // Convert from TaskModel to JSON<br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;id&#39;: id,<br>      &#39;title&#39;: title,<br>      &#39;description&#39;: description,<br>      &#39;isCompleted&#39;: isCompleted,<br>    };<br>  }<br>}</pre><h4>Step 2: Create the Remote Data Source</h4><p>The <strong>Remote Data Source</strong> handles API calls. It fetches data from a REST API and returns a list of TaskModel objects.</p><pre>import &#39;package:http/http.dart&#39; as http;<br>import &#39;dart:convert&#39;;<br><br>abstract class RemoteTaskDataSource {<br>  Future&lt;List&lt;TaskModel&gt;&gt; fetchTasks();<br>  Future&lt;void&gt; saveTask(TaskModel task);<br>}<br><br>class RemoteTaskDataSourceImpl implements RemoteTaskDataSource {<br>  final http.Client client;<br><br>  RemoteTaskDataSourceImpl(this.client);<br><br>  @override<br>  Future&lt;List&lt;TaskModel&gt;&gt; fetchTasks() async {<br>    final response = await client.get(Uri.parse(&#39;https://example.com/api/tasks&#39;));<br><br>    if (response.statusCode == 200) {<br>      List&lt;dynamic&gt; taskJson = jsonDecode(response.body);<br>      return taskJson.map((json) =&gt; TaskModel.fromJson(json)).toList();<br>    } else {<br>      throw Exception(&#39;Failed to load tasks&#39;);<br>    }<br>  }<br><br>  @override<br>  Future&lt;void&gt; saveTask(TaskModel task) async {<br>    final response = await client.post(<br>      Uri.parse(&#39;https://example.com/api/tasks&#39;),<br>      headers: {&#39;Content-Type&#39;: &#39;application/json&#39;},<br>      body: jsonEncode(task.toJson()),<br>    );<br><br>    if (response.statusCode != 201) {<br>      throw Exception(&#39;Failed to save task&#39;);<br>    }<br>  }<br>}</pre><p>In this example, RemoteTaskDataSourceImpl uses the http package to make network requests to a remote API. The data is fetched in JSON format, and TaskModel objects are created using the fromJson() factory method.</p><h4>Step 3: Create the Local Data Source</h4><p>The <strong>Local Data Source</strong> handles saving and retrieving data from a local database, such as SQLite.</p><pre>import &#39;package:sqflite/sqflite.dart&#39;;<br><br>abstract class LocalTaskDataSource {<br>  Future&lt;List&lt;TaskModel&gt;&gt; getTasksFromDb();<br>  Future&lt;void&gt; insertTask(TaskModel task);<br>}<br><br>class LocalTaskDataSourceImpl implements LocalTaskDataSource {<br>  final Database db;<br><br>  LocalTaskDataSourceImpl(this.db);<br><br>  @override<br>  Future&lt;List&lt;TaskModel&gt;&gt; getTasksFromDb() async {<br>    final List&lt;Map&lt;String, dynamic&gt;&gt; tasks = await db.query(&#39;tasks&#39;);<br>    return tasks.map((task) =&gt; TaskModel.fromJson(task)).toList();<br>  }<br><br>  @override<br>  Future&lt;void&gt; insertTask(TaskModel task) async {<br>    await db.insert(&#39;tasks&#39;, task.toJson());<br>  }<br>}</pre><p>Here, the LocalTaskDataSourceImpl uses SQLite to store tasks locally. This is useful when the app needs to support offline functionality.</p><h4>Step 4: Integrate Data Sources with the Repository</h4><p>The <strong>Repository</strong> abstracts the logic of selecting between remote or local data sources. It can decide where to fetch data based on specific conditions, such as network availability.</p><pre>class TaskRepositoryImpl implements TaskRepository {<br>  final RemoteTaskDataSource remoteTaskDataSource;<br>  final LocalTaskDataSource localTaskDataSource;<br><br>  TaskRepositoryImpl(this.remoteTaskDataSource, this.localTaskDataSource);<br><br>  @override<br>  Future&lt;List&lt;Task&gt;&gt; getTasks() async {<br>    try {<br>      // Fetch tasks from the remote source<br>      final taskModels = await remoteTaskDataSource.fetchTasks();<br><br>      // Convert TaskModels to Entities<br>      return taskModels.map((model) =&gt; Task(<br>        id: model.id,<br>        title: model.title,<br>        description: model.description,<br>        isCompleted: model.isCompleted,<br>      )).toList();<br>    } catch (e) {<br>      // In case of failure, fetch tasks from local database<br>      final taskModels = await localTaskDataSource.getTasksFromDb();<br>      return taskModels.map((model) =&gt; Task(<br>        id: model.id,<br>        title: model.title,<br>        description: model.description,<br>        isCompleted: model.isCompleted,<br>      )).toList();<br>    }<br>  }<br><br>  @override<br>  Future&lt;void&gt; saveTask(Task task) async {<br>    final taskModel = TaskModel(<br>      id: task.id,<br>      title: task.title,<br>      description: task.description,<br>      isCompleted: task.isCompleted,<br>    );<br><br>    // Save task both remotely and locally<br>    await remoteTaskDataSource.saveTask(taskModel);<br>    await localTaskDataSource.insertTask(taskModel);<br>  }<br>}</pre><p>In this example, the TaskRepositoryImpl is using both the <strong>Remote Data Source</strong> and <strong>Local Data Source</strong>. It tries to fetch tasks from the remote API first, and in case of failure (e.g., no internet), it falls back to the local database.</p><h3>Best Practices 🥈</h3><ol><li><strong>Abstraction and Interfaces</strong>: Always define abstract interfaces (RemoteTaskDataSource, LocalTaskDataSource) for your data sources. This allows for easy testing and replacement of data source implementations.</li><li><strong>Error Handling</strong>: Ensure proper error handling, especially when switching between remote and local sources. Always handle failures gracefully and provide fallback mechanisms (e.g., fetching from local storage when remote fetch fails).</li><li><strong>Caching</strong>: Implement caching in local data sources to optimize performance. For example, you can save data from remote sources to a local database and fetch from there if the device is offline.</li><li><strong>Dependency Injection</strong>: Use dependency injection (via Provider, get_it, or riverpod) to provide data sources and repositories to different layers of your application. This ensures modularity and testability.</li><li><strong>Offline-First Approach</strong>: In some applications, you may need to adopt an offline-first approach. In such cases, prioritize the local data source and synchronize it with the remote data source in the background.</li><li><strong>Testing</strong>: Mock your data sources during unit testing. For example, use the mockito package to mock the behavior of remote or local data sources.</li></ol><h3>Conclusion 📰</h3><p><strong>Data Sources</strong> in Clean Architecture serve as the gateway between your application’s <strong>Data Layer</strong> and external systems like APIs or local databases. By abstracting data access and structuring your data sources properly, you ensure that your application remains flexible, scalable, and maintainable.</p><p>Following best practices such as defining clear interfaces, handling errors gracefully, and using caching or offline-first strategies will help you build robust Flutter applications that can adapt to different data requirements over time. Implementing data sources correctly is key to keeping your app’s data flow clean and well-organized.</p><ul><li><a href="https://blog.stackademic.com/use-cases-in-clean-architecture-for-flutter-bridge-the-gap-f6d8a181f874">Use Cases in Clean Architecture for Flutter: Bridge the Gap</a></li><li><a href="https://blog.stackademic.com/building-clean-architecture-in-flutter-with-repository-pattern-2af302fc22f2">Building Clean Architecture in Flutter with Repository Pattern</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a></li><li><a href="https://differ.blog/"><strong>Create a free AI-powered blog on Differ.</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4c0833f17ed" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-robust-data-sources-in-clean-architecture-for-flutter-e4c0833f17ed">Building Robust Data Sources in Clean Architecture for Flutter</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use Cases in Clean Architecture for Flutter: Bridge the Gap]]></title>
            <link>https://blog.stackademic.com/use-cases-in-clean-architecture-for-flutter-bridge-the-gap-f6d8a181f874?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6d8a181f874</guid>
            <category><![CDATA[use-cases]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Sat, 12 Oct 2024 14:20:53 GMT</pubDate>
            <atom:updated>2024-10-14T06:29:08.005Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*KQGITW3gMFFOGE-58FHqUw.png" /></figure><h3>Introduction 🌅</h3><p>In Clean Architecture, the <strong>Domain Layer</strong> is the heart of the application, where all core business rules and logic reside. <strong>Use Cases</strong>, also known as <strong>Interactors</strong>, play a crucial role in this layer by encapsulating the application’s business logic and ensuring that it remains isolated from external dependencies such as APIs, databases, or UI. Understanding the role of Use Cases is vital for building scalable, maintainable, and testable Flutter applications.</p><h3>What Are Use Cases in Clean Architecture? 🤔</h3><p>A <strong>Use Case</strong> represents a specific business action or functionality that an application needs to perform. It defines the flow of data between the <strong>Domain Layer</strong> and the <strong>Data Layer</strong> and is responsible for executing a particular task without being concerned with how or where the data is sourced.</p><p>The Use Case acts as an intermediary between the app’s core business logic (e.g., <strong>Entities</strong>) and external interactions (e.g., <strong>Repositories</strong>). By separating business logic into discrete Use Cases, we ensure that the app’s rules are cleanly defined, reusable, and easy to test.</p><h4>Characteristics of a Use Case 💄</h4><ol><li><strong>Single Responsibility</strong>: A Use Case should focus on a single piece of business logic or functionality, such as fetching data, saving data, or performing a calculation.</li><li><strong>Isolation from Data Sources</strong>: A Use Case doesn’t care about the source of the data (API, database, etc.). It only knows how to execute a business rule by interacting with repositories or entities.</li><li><strong>Reusable and Testable</strong>: Use Cases are written in plain Dart and are independent of Flutter-specific classes, making them reusable across different parts of the app and easily testable.</li></ol><h3>Why Use Cases Are Important in Flutter Apps 🕵🏻‍♀️</h3><ol><li><strong>Separation of Business Logic</strong>: By placing business logic in Use Cases, you prevent it from leaking into the presentation layer (UI) or data handling layer. This keeps your app’s structure clean and modular.</li><li><strong>Decoupling</strong>: Use Cases allow for decoupling the business logic from other layers of the application, such as UI or data management. This improves flexibility, allowing changes in one layer without affecting others.</li><li><strong>Testability</strong>: Since Use Cases are independent of the Flutter framework and external data sources, they can be easily unit tested. Mocking repositories or services enables effective testing of Use Cases in isolation.</li><li><strong>Reusability</strong>: Use Cases can be reused across different parts of the application. For example, a GetUserDetailsUseCase can be used in multiple screens without duplicating code.</li></ol><h3>Implementing Use Cases in Flutter 🛠️</h3><p>Let’s implement Use Cases in a Flutter app that manages tasks, following Clean Architecture principles. We’ll focus on the core flow from the <strong>Domain Layer</strong> to the <strong>Data Layer</strong> using a repository.</p><h4>Step 1: Define the Task Entity</h4><p>An <strong>Entity</strong> represents the core business object. In this case, we define a Task entity that encapsulates the concept of a task in our domain.</p><pre>class Task {<br>  final String id;<br>  final String title;<br>  final String description;<br>  final bool isCompleted;<br><br>  Task({<br>    required this.id,<br>    required this.title,<br>    required this.description,<br>    this.isCompleted = false,<br>  });<br><br>  Task complete() {<br>    return Task(<br>      id: id,<br>      title: title,<br>      description: description,<br>      isCompleted: true,<br>    );<br>  }<br>}</pre><h4>Step 2: Define the Task Repository Interface</h4><p>The repository interface abstracts the data layer and provides methods to interact with the data, regardless of the source (API, database, etc.). The <strong>Domain Layer</strong> should only depend on this interface.</p><pre>abstract class TaskRepository {<br>  Future&lt;List&lt;Task&gt;&gt; getTasks();<br>  Future&lt;void&gt; addTask(Task task);<br>  Future&lt;void&gt; updateTask(Task task);<br>}</pre><h4>Step 3: Create the Use Case Class</h4><p>Now, we implement a Use Case for fetching tasks, GetTasksUseCase, which encapsulates the logic of retrieving tasks from the repository.</p><pre>class GetTasksUseCase {<br>  final TaskRepository repository;<br><br>  GetTasksUseCase(this.repository);<br><br>  Future&lt;List&lt;Task&gt;&gt; execute() async {<br>    return await repository.getTasks();<br>  }<br>}</pre><p>This Use Case interacts with the repository to retrieve tasks, but it doesn’t care whether the data comes from an API, database, or cache. This separation allows the <strong>Domain Layer</strong> to remain unaware of the underlying data sources.</p><h4>Step 4: Implement the Use Case in the Presentation Layer</h4><p>Now that we have defined our Use Case, let’s integrate it into the UI layer using <strong>Provider</strong> or <strong>Bloc</strong> to call the Use Case in a Flutter widget. We’ll use Provider for simplicity.</p><pre>class TaskListViewModel extends ChangeNotifier {<br>  final GetTasksUseCase getTasksUseCase;<br><br>  List&lt;Task&gt; tasks = [];<br>  bool isLoading = false;<br><br>  TaskListViewModel(this.getTasksUseCase);<br><br>  Future&lt;void&gt; fetchTasks() async {<br>    isLoading = true;<br>    notifyListeners();<br><br>    tasks = await getTasksUseCase.execute();<br>    <br>    isLoading = false;<br>    notifyListeners();<br>  }<br>}</pre><p>This ViewModel/Controller interacts with the Use Case and updates the UI when the tasks are fetched. The UI layer doesn’t need to know where or how the data is fetched, only that the Use Case provides it.</p><pre>class TaskListScreen extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    final taskListViewModel = Provider.of&lt;TaskListViewModel&gt;(context);<br><br>    return Scaffold(<br>      appBar: AppBar(title: Text(&#39;Task List&#39;)),<br>      body: taskListViewModel.isLoading<br>          ? Center(child: CircularProgressIndicator())<br>          : ListView.builder(<br>              itemCount: taskListViewModel.tasks.length,<br>              itemBuilder: (context, index) {<br>                final task = taskListViewModel.tasks[index];<br>                return ListTile(<br>                  title: Text(task.title),<br>                  subtitle: Text(task.description),<br>                  trailing: Icon(<br>                    task.isCompleted ? Icons.check : Icons.circle,<br>                    color: task.isCompleted ? Colors.green : Colors.red,<br>                  ),<br>                );<br>              },<br>            ),<br>    );<br>  }<br>}</pre><p>Here, the UI interacts with the ViewModel (which in turn interacts with the Use Case), keeping everything decoupled and following Clean Architecture principles.</p><h3>Handling Multiple Use Cases 👩🏻‍👦🏻‍🧒🏻</h3><p>Sometimes, a single screen might require multiple Use Cases. For example, a task details screen might need both a GetTaskByIdUseCase and an UpdateTaskUseCase. In such cases, you can inject multiple Use Cases into the ViewModel.</p><pre>class TaskDetailViewModel extends ChangeNotifier {<br>  final GetTaskByIdUseCase getTaskByIdUseCase;<br>  final UpdateTaskUseCase updateTaskUseCase;<br><br>  Task? task;<br><br>  TaskDetailViewModel(<br>    this.getTaskByIdUseCase,<br>    this.updateTaskUseCase,<br>  );<br><br>  Future&lt;void&gt; loadTask(String id) async {<br>    task = await getTaskByIdUseCase.execute(id);<br>    notifyListeners();<br>  }<br><br>  Future&lt;void&gt; completeTask() async {<br>    if (task != null) {<br>      final updatedTask = task!.complete();<br>      await updateTaskUseCase.execute(updatedTask);<br>      task = updatedTask;<br>      notifyListeners();<br>    }<br>  }<br>}</pre><p>This approach keeps the responsibilities of different Use Cases separate, making the business logic modular and easy to extend.</p><h3>Best Practices for Using Use Cases 🥈</h3><ol><li><strong>Single Responsibility Principle</strong>: Each Use Case should handle one specific business action. For example, GetTasksUseCase should only be responsible for fetching tasks, and UpdateTaskUseCase should handle updating tasks.</li><li><strong>Independent of UI and Data Layers</strong>: Use Cases should never interact with Flutter-specific classes or directly handle data source logic (e.g., network requests, database queries). Use Cases only interact with <strong>Repositories</strong> and <strong>Entities</strong>.</li><li><strong>Keep Use Cases Simple</strong>: Use Cases should be simple and straightforward. Avoid overloading Use Cases with too much logic. If a Use Case becomes complex, consider breaking it down into smaller Use Cases.</li><li><strong>Error Handling</strong>: Handle errors inside the repository or Use Case level and propagate user-friendly messages or results to the UI layer. This ensures that the business logic is robust and fault-tolerant.</li><li><strong>Test Use Cases Independently</strong>: Write unit tests for each Use Case in isolation by mocking the repository. This ensures that the business logic is correct and decoupled from external dependencies.]]</li></ol><h3>Example of Testing a Use Case 🧪</h3><p>Testing Use Cases is straightforward because they are decoupled from external frameworks and dependencies. Here’s an example of how you might test the GetTasksUseCase:</p><pre>import &#39;package:flutter_test/flutter_test.dart&#39;;<br>import &#39;package:mockito/mockito.dart&#39;;<br><br>// Mock Repository<br>class MockTaskRepository extends Mock implements TaskRepository {}<br><br>void main() {<br>  late MockTaskRepository mockTaskRepository;<br>  late GetTasksUseCase getTasksUseCase;<br><br>  setUp(() {<br>    mockTaskRepository = MockTaskRepository();<br>    getTasksUseCase = GetTasksUseCase(mockTaskRepository);<br>  });<br><br>  test(&#39;should return a list of tasks from the repository&#39;, () async {<br>    // Arrange<br>    final tasks = [<br>      Task(id: &#39;1&#39;, title: &#39;Test Task&#39;, description: &#39;Test Description&#39;),<br>    ];<br>    when(mockTaskRepository.getTasks()).thenAnswer((_) async =&gt; tasks);<br><br>    // Act<br>    final result = await getTasksUseCase.execute();<br><br>    // Assert<br>    expect(result, tasks);<br>    verify(mockTaskRepository.getTasks()).called(1);<br>  });<br>}</pre><p>By using <strong>Mockito</strong>, we can mock the repository and verify that the Use Case is behaving correctly.</p><h3>Conclusion 📰</h3><p>In Clean Architecture, <strong>Use Cases</strong> are the gateway to the <strong>Domain Layer</strong>, encapsulating the business logic and ensuring that the core rules of the application remain independent of external dependencies. They provide clean, reusable, and testable business logic, making the application more modular, maintainable, and easy to scale.</p><p>By adhering to best practices like single responsibility, decoupling, and error handling, you can ensure that your Flutter application follows Clean Architecture principles effectively, making it easier to manage and extend over time.</p><p>Implementing and leveraging Use Cases properly is a cornerstone of writing maintainable, clean, and scalable Flutter applications.</p><ul><li><a href="https://blog.stackademic.com/building-clean-architecture-in-flutter-with-repository-pattern-2af302fc22f2">Building Clean Architecture in Flutter with Repository Pattern</a></li><li><a href="https://blog.stackademic.com/understanding-entity-and-model-in-clean-architecture-for-flutter-fcc726f6e6e2">Understanding Entity and Model in Clean Architecture for Flutter</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6d8a181f874" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/use-cases-in-clean-architecture-for-flutter-bridge-the-gap-f6d8a181f874">Use Cases in Clean Architecture for Flutter: Bridge the Gap</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Clean Architecture in Flutter with Repository Pattern]]></title>
            <link>https://blog.stackademic.com/building-clean-architecture-in-flutter-with-repository-pattern-2af302fc22f2?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2af302fc22f2</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[repository-pattern]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Sat, 05 Oct 2024 04:18:43 GMT</pubDate>
            <atom:updated>2024-10-07T03:14:44.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*CNSlAtYuX90fa0BWNy0KNw.png" /></figure><h3>Introduction 🌅</h3><p>As Flutter applications grow in complexity, it’s essential to maintain a structure that supports scalability, testability, and maintainability. <strong>Clean Architecture </strong>emphasizes the separation of concerns across various layers of the application. One of the most critical patterns in Clean Architecture is the <strong>Repository Pattern</strong>, which acts as a bridge between the <strong>Domain Layer</strong> and the <strong>Data Layer</strong>.</p><h3>The Role of the Repository Pattern in Clean Architecture 👩🏻‍💼</h3><p>In Clean Architecture, the application is typically divided into three main layers:</p><ol><li><strong>Presentation Layer</strong>: Handles the UI and user interaction.</li><li><strong>Domain Layer</strong>: Contains the core business logic and rules.</li><li><strong>Data Layer</strong>: Manages data from external sources (e.g., REST APIs, databases, etc.).</li></ol><p>The <strong>Repository Pattern</strong> sits between the <strong>Domain Layer</strong> and the <strong>Data Layer</strong>. Its primary role is to abstract and encapsulate data-fetching logic so that the <strong>Domain Layer</strong> doesn’t need to know about the details of how or where the data is stored or fetched.</p><h4>Why Do We Need the Repository Pattern? 🤔</h4><ol><li><strong>Separation of Concerns</strong>: The Repository Pattern isolates the <strong>Domain Layer</strong> from the <strong>Data Layer</strong>. This ensures that business logic can function independently of data sources.</li><li><strong>Testability</strong>: By abstracting the data sources behind a repository interface, we can mock data sources and write tests for the business logic without needing to connect to real databases or APIs.</li><li><strong>Flexibility</strong>: The repository makes it easy to switch between different data sources (like local storage, APIs, or cached data) without affecting the rest of the application.</li><li><strong>Abstraction</strong>: Domain logic doesn’t need to know whether data comes from an API, a database, or cache. It simply interacts with the repository interface, making the code more maintainable.</li></ol><h3>Principles of the Repository Pattern 🚴🏻‍♀️</h3><ol><li><strong>Single Responsibility</strong>: A repository should have one primary responsibility: retrieving and saving data. It should not contain business logic or UI-related functionality.</li><li><strong>Data Source Abstraction</strong>: The repository abstracts the details of the underlying data source (e.g., REST API, local database). The domain layer interacts with a repository interface, unaware of the actual implementation.</li><li><strong>Returning Entities</strong>: The repository returns <strong>Entities</strong>, which are pure business objects, to the domain layer. It may internally convert data from <strong>Models</strong> (data-layer objects) to <strong>Entities</strong>.</li><li><strong>Error Handling</strong>: The repository is responsible for handling errors from the data sources and passing relevant information up to the domain layer in a clean manner.</li></ol><h3>Implementing the Repository Pattern in Flutter 🛠️</h3><p>Let’s walk through an implementation of the Repository Pattern using an example Flutter application that manages tasks. The app will fetch tasks from a REST API, save them locally in a database, and expose the business logic to the <strong>Domain Layer</strong> through the repository.</p><h4>Step 1: Define the Task Entity</h4><p>Entities represent the business logic and reside in the <strong>Domain Layer</strong>. Here is an example of a Task entity:</p><pre>class Task {<br>  final String id;<br>  final String title;<br>  final String description;<br>  final bool isCompleted;<br><br>  Task({<br>    required this.id,<br>    required this.title,<br>    required this.description,<br>    this.isCompleted = false,<br>  });<br><br>  Task complete() {<br>    return Task(<br>      id: id,<br>      title: title,<br>      description: description,<br>      isCompleted: true,<br>    );<br>  }<br>}</pre><h4>Step 2: Create the TaskModel for Data Representation</h4><p>The <strong>TaskModel</strong> represents the data structure in the <strong>Data Layer</strong>, which handles JSON serialization and deserialization:</p><pre>class TaskModel {<br>  final String id;<br>  final String title;<br>  final String description;<br>  final bool isCompleted;<br><br>  TaskModel({<br>    required this.id,<br>    required this.title,<br>    required this.description,<br>    required this.isCompleted,<br>  });<br><br>  factory TaskModel.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return TaskModel(<br>      id: json[&#39;id&#39;] as String,<br>      title: json[&#39;title&#39;] as String,<br>      description: json[&#39;description&#39;] as String,<br>      isCompleted: json[&#39;isCompleted&#39;] as bool,<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;id&#39;: id,<br>      &#39;title&#39;: title,<br>      &#39;description&#39;: description,<br>      &#39;isCompleted&#39;: isCompleted,<br>    };<br>  }<br>}</pre><h4>Step 3: Define the Task Repository Interface</h4><p>The repository interface lives in the <strong>Domain Layer</strong> and defines the methods the domain logic can use. It doesn’t care where the data comes from (API, database, etc.).</p><pre>abstract class TaskRepository {<br>  Future&lt;List&lt;Task&gt;&gt; getTasks();<br>  Future&lt;void&gt; saveTask(Task task);<br>  Future&lt;void&gt; updateTask(Task task);<br>}</pre><h4>Step 4: Implement the TaskRepository with Data Sources</h4><p>In the <strong>Data Layer</strong>, we implement the repository that connects to the external data sources, such as an API or a database. This implementation handles data fetching, transformation, and error management.</p><pre>class TaskRepositoryImpl implements TaskRepository {<br>  final TaskApi _taskApi;<br>  final TaskDatabase _taskDatabase;<br><br>  TaskRepositoryImpl(this._taskApi, this._taskDatabase);<br><br>  @override<br>  Future&lt;List&lt;Task&gt;&gt; getTasks() async {<br>    try {<br>      // Fetch tasks from API<br>      final taskModels = await _taskApi.fetchTasks();<br>      return taskModels.map((taskModel) =&gt; Task(<br>        id: taskModel.id,<br>        title: taskModel.title,<br>        description: taskModel.description,<br>        isCompleted: taskModel.isCompleted,<br>      )).toList();<br>    } catch (e) {<br>      // Handle error (e.g., API failure) and return empty list<br>      print(&quot;Error fetching tasks: $e&quot;);<br>      return [];<br>    }<br>  }<br><br>  @override<br>  Future&lt;void&gt; saveTask(Task task) async {<br>    try {<br>      // Convert Task to TaskModel and save it via API<br>      final taskModel = TaskModel(<br>        id: task.id,<br>        title: task.title,<br>        description: task.description,<br>        isCompleted: task.isCompleted,<br>      );<br>      await _taskApi.saveTask(taskModel);<br>    } catch (e) {<br>      // Error handling logic<br>      print(&quot;Error saving task: $e&quot;);<br>    }<br>  }<br><br>  @override<br>  Future&lt;void&gt; updateTask(Task task) async {<br>    try {<br>      // Convert Task to TaskModel and update it in the database<br>      final taskModel = TaskModel(<br>        id: task.id,<br>        title: task.title,<br>        description: task.description,<br>        isCompleted: task.isCompleted,<br>      );<br>      await _taskDatabase.updateTask(taskModel);<br>    } catch (e) {<br>      // Error handling logic<br>      print(&quot;Error updating task: $e&quot;);<br>    }<br>  }<br>}</pre><p>Here, TaskRepositoryImpl fetches data from an API (TaskApi) or updates tasks in a local database (TaskDatabase). The repository translates between <strong>TaskModel</strong> (used by the API/database) and <strong>Task</strong> (used by the Domain Layer).</p><h4>Step 5: Exposing the Repository to Use Cases</h4><p>Use Cases (or Interactors) are part of the <strong>Domain Layer</strong> and handle the business logic. They access the repository to retrieve or update data without worrying about the underlying data source.</p><pre>class GetTasksUseCase {<br>  final TaskRepository repository;<br><br>  GetTasksUseCase(this.repository);<br><br>  Future&lt;List&lt;Task&gt;&gt; call() async {<br>    return await repository.getTasks();<br>  }<br>}</pre><p>The use case simply invokes the repository to retrieve tasks. The rest of the application (like the UI layer) can interact with this use case to fetch the tasks, keeping the domain logic independent of data sources.</p><h3>Best Practices for Using the Repository Pattern 🌉</h3><ol><li><strong>Abstract Repositories</strong>: Always define repository interfaces in the <strong>Domain Layer</strong> to decouple business logic from data sources. This keeps your code flexible and testable.</li><li><strong>Separation of Concerns</strong>: Keep repositories focused solely on data-fetching logic. Avoid mixing business rules, validation, or UI-related concerns into repository implementations.</li><li><strong>Error Handling</strong>: Handle data source errors in the repository and make sure to propagate meaningful messages to the domain layer. Avoid leaking lower-level exceptions (like network errors) to the business logic.</li><li><strong>Use Dependency Injection</strong>: Inject repositories into your use cases and presentation layers to ensure modularity and make testing easier. This helps replace real implementations with mock ones during testing.</li><li><strong>Unit Testing</strong>: Since repositories act as intermediaries between data sources and business logic, it’s crucial to write tests for them. Use dependency injection to inject mock data sources and verify that the repository works as expected under different scenarios.</li></ol><h3>Conclusion 📰</h3><p>The <strong>Repository Pattern</strong> plays a vital role in Clean Architecture by abstracting the data-fetching layer from the domain logic. It promotes separation of concerns, improves testability, and provides flexibility for changing data sources in the future. By defining repository interfaces in the <strong>Domain Layer</strong> and implementing them in the <strong>Data Layer</strong>, you can ensure that your Flutter application is well-structured and maintainable.</p><ul><li><a href="https://medium.com/@adityagmhatre/understanding-entity-and-model-in-clean-architecture-for-flutter-fcc726f6e6e2">Understanding Entity and Model in Clean Architecture for Flutter</a></li><li><a href="https://medium.com/@adityagmhatre/understanding-event-channel-and-method-channel-in-flutter-and-dart-9134d6a8ceba">Understanding Event &amp; Method Channel in Flutter</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2af302fc22f2" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-clean-architecture-in-flutter-with-repository-pattern-2af302fc22f2">Building Clean Architecture in Flutter with Repository Pattern</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Entity and Model in Clean Architecture for Flutter]]></title>
            <link>https://blog.stackademic.com/understanding-entity-and-model-in-clean-architecture-for-flutter-fcc726f6e6e2?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcc726f6e6e2</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[model]]></category>
            <category><![CDATA[entity]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 09:48:34 GMT</pubDate>
            <atom:updated>2024-10-03T04:30:19.139Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*CN1ViX6bhGvSTdQGdMnqdw.png" /></figure><h3>Introduction 🌅</h3><p>Clean Architecture is a software design philosophy that emphasizes separation of concerns and clear boundaries between layers. This architecture pattern is widely used in the Flutter ecosystem for building scalable, testable, and maintainable applications. One of the key concepts in Clean Architecture is the distinction between <strong>Entities</strong> and <strong>Models</strong>.</p><p>In this article, we’ll Understand the distinction between Entities and Models is crucial for adhering to Clean Architecture principles and building a solid, maintainable Flutter application.</p><h3>The Need for Clean Architecture in Flutter 🤔</h3><p>Before diving into the specifics of Entities and Models, it’s essential to understand why Clean Architecture is important for Flutter development. Flutter apps can grow in complexity as they scale, and without a proper structure, managing code can become difficult. Clean Architecture provides clear boundaries between different layers (such as domain, data, and presentation), making the app easier to maintain, test, and scale.</p><ul><li><strong>Domain Layer</strong>: The business logic and core rules of the application.</li><li><strong>Data Layer</strong>: Handles data sources like REST APIs, local databases, or caches.</li><li><strong>Presentation Layer</strong>: Manages UI and user interactions.</li></ul><h3>Entity 🎡</h3><p>An <strong>Entity</strong> represents a core business object or concept that is central to the business logic. It is defined within the <strong>Domain Layer</strong> of the architecture.</p><h4>Characteristics of an Entity:</h4><ol><li><strong>Domain-Centric</strong>: Entities only contain properties and methods that are directly related to the business logic. They are independent of the user interface or data sources.</li><li><strong>Immutable by Design</strong>: Entities should ideally be immutable to ensure the predictability and consistency of business logic.</li></ol><h4>Example:</h4><p>Let’s assume we are building a Flutter app for managing tasks. An Entity representing a task could look like this:</p><pre>class Task {<br>  final String id;<br>  final String title;<br>  final String description;<br>  final bool isCompleted;<br><br>  Task({<br>    required this.id,<br>    required this.title,<br>    required this.description,<br>    this.isCompleted = false,<br>  });<br><br>  // Business logic to mark the task as complete<br>  Task complete() {<br>    return Task(<br>      id: id,<br>      title: title,<br>      description: description,<br>      isCompleted: true,<br>    );<br>  }<br>}</pre><p>In this example, the Task entity is focused purely on the domain logic. It is not concerned with how or where data is fetched, saved, or presented in the UI.</p><h3>Model 🛞</h3><p>A <strong>Model</strong> (often called a Data Transfer Object, or DTO) represents the data structure used to interact with external sources, like APIs, databases, or local storage. Unlike Entities, Models are placed in the <strong>Data Layer</strong> and deal with external formats like JSON or database records.</p><h4>Characteristics of a Model:</h4><ol><li><strong>Data-Centric</strong>: Models are focused on mapping external data sources into Dart objects and vice versa.</li><li><strong>Serialization/Deserialization</strong>: Models usually have methods to serialize (convert to JSON or other formats) and deserialize (convert from external data sources to Dart objects).</li></ol><h4>Example:</h4><p>Using the same example of a task management app, a Model for fetching tasks from a REST API could look like this:</p><pre>class TaskModel {<br>  final String id;<br>  final String title;<br>  final String description;<br>  final bool isCompleted;<br><br>  TaskModel({<br>    required this.id,<br>    required this.title,<br>    required this.description,<br>    required this.isCompleted,<br>  });<br><br>  // Factory method to create a TaskModel from JSON<br>  factory TaskModel.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return TaskModel(<br>      id: json[&#39;id&#39;] as String,<br>      title: json[&#39;title&#39;] as String,<br>      description: json[&#39;description&#39;] as String,<br>      isCompleted: json[&#39;isCompleted&#39;] as bool,<br>    );<br>  }<br><br>  // Method to convert TaskModel to JSON<br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;id&#39;: id,<br>      &#39;title&#39;: title,<br>      &#39;description&#39;: description,<br>      &#39;isCompleted&#39;: isCompleted,<br>    };<br>  }<br>}</pre><p>Here, the TaskModel is used to map the JSON data coming from an API into a Dart object, making it easier to work with the data in the app. It includes methods for serializing and deserializing the data.</p><h3>How Entities and Models Work Together ? 🛠️</h3><p>In Clean Architecture, Entities and Models are often used together, but they serve different purposes. The typical workflow is:</p><ol><li><strong>Repository Pattern</strong>: The Repository acts as a mediator between the Domain Layer (Entities) and the Data Layer (Models). It abstracts the data sources, allowing the domain to remain independent of where the data comes from.</li><li><strong>Data Mapping</strong>: When data is fetched from an external source (API, database), a Model is used to deserialize it. This model is then converted into an Entity so that the Domain Layer can use it without worrying about the data source.</li><li><strong>Returning Entities</strong>: When the Domain Layer is done processing the data (using the business logic in Entities), the data is passed back through the Repository. If necessary, the Repository converts the Entity back into a Model for persistence or external communication.</li></ol><h4>Example:</h4><p>Let’s say we have a TaskEntity and a TaskModel. The repository might convert between the two like this:</p><pre>class TaskRepository {<br>  final TaskApi _taskApi;<br><br>  TaskRepository(this._taskApi);<br><br>  // Fetch tasks from API and map them to Entities<br>  Future&lt;List&lt;Task&gt;&gt; fetchTasks() async {<br>    final taskModels = await _taskApi.getTasks();<br>    return taskModels.map((taskModel) =&gt; Task(<br>      id: taskModel.id,<br>      title: taskModel.title,<br>      description: taskModel.description,<br>      isCompleted: taskModel.isCompleted,<br>    )).toList();<br>  }<br><br>  // Save a Task Entity by converting it to a Model<br>  Future&lt;void&gt; saveTask(Task task) async {<br>    final taskModel = TaskModel(<br>      id: task.id,<br>      title: task.title,<br>      description: task.description,<br>      isCompleted: task.isCompleted,<br>    );<br>    await _taskApi.saveTask(taskModel);<br>  }<br>}</pre><p>Here, the repository handles the conversion between TaskEntity (used in the domain) and TaskModel (used for API communication).</p><h3>Best Practices</h3><ol><li><strong>Separation of Concerns</strong>: Keep Entities free from external data source concerns and focus only on business logic. Models, on the other hand, should focus on data structure and serialization.</li><li><strong>Immutability</strong>: Both Entities and Models should ideally be immutable. This ensures predictability and makes testing easier.</li><li><strong>Keep Entities Clean</strong>: Avoid adding logic related to data fetching or UI to Entities. They should be plain Dart objects that encapsulate business logic.</li><li><strong>Repository Abstraction</strong>: Use repositories to abstract the conversion between Entities and Models, keeping the Domain and Data layers decoupled.</li></ol><h3>Conclusion 📰</h3><p>Understanding the difference between <strong>Entities</strong> and <strong>Models</strong> in Clean Architecture is crucial for building well-structured and maintainable Flutter applications. While <strong>Entities</strong> encapsulate the core business logic and reside in the Domain Layer, <strong>Models</strong> handle external data representation in the Data Layer. By keeping these roles distinct and using the Repository pattern to mediate between them, you ensure that your app is more scalable, testable, and maintainable over time.</p><ul><li><a href="https://medium.com/@adityagmhatre/understanding-event-channel-and-method-channel-in-flutter-and-dart-9134d6a8ceba">Understanding Event &amp; Method Channel in Flutter</a></li><li><a href="https://blog.stackademic.com/unveiling-the-magic-of-custom-painters-8cf602eb95ff">Unveiling the Magic of Custom Painters</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcc726f6e6e2" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/understanding-entity-and-model-in-clean-architecture-for-flutter-fcc726f6e6e2">Understanding Entity and Model in Clean Architecture for Flutter</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Event & Method Channel in Flutter]]></title>
            <link>https://blog.stackademic.com/understanding-event-channel-and-method-channel-in-flutter-and-dart-9134d6a8ceba?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9134d6a8ceba</guid>
            <category><![CDATA[native]]></category>
            <category><![CDATA[flutterchannel]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[channel]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 15:29:04 GMT</pubDate>
            <atom:updated>2024-10-03T04:30:03.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*O7hJkuSnYj9rYxVuNoq-Ww.png" /></figure><p>Flutter, Google’s UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase, leverages Dart as its programming language. To interact with native code, Flutter provides two primary mechanisms: Event Channel and Method Channel. These channels facilitate communication between the Flutter app and platform-specific code, enabling developers to harness native features seamlessly.</p><h3>Introduction 🌅</h3><p>In the context of mobile application development, it often becomes necessary to interact with platform-specific APIs or services. This is where Flutter’s Event Channel and Method Channel come into play. They provide a robust framework for integrating Flutter apps with native code, allowing for a more versatile and powerful application.</p><h4>What is a Method Channel? 🤔</h4><p>A Method Channel in Flutter is used for communication between the Flutter module and native code. It allows Dart to invoke methods on the native side and receive results. This is particularly useful for one-off requests where the Flutter app calls a function and waits for a response.</p><h4>What is an Event Channel? 🤔</h4><p>An Event Channel, on the other hand, is designed for continuous data streams. It facilitates a communication pattern where the native side can send a stream of data to the Flutter side. This is ideal for scenarios where the app needs to listen to ongoing data changes, such as sensor readings or network connectivity updates.</p><h3>The Need for Method and Event Channels 🛞</h3><h4>Bridging the Gap Between Flutter and Native Code 🌉</h4><p>Despite Flutter’s extensive capabilities, certain functionalities are best handled using native APIs. These include accessing device-specific features like sensors, camera, battery status, or integrating with platform-specific services. Method Channel and Event Channel provide a bridge for these interactions.</p><h4>Efficient Data Handling 🚴🏻‍♀️</h4><ul><li><strong>Method Channel</strong> is optimal for one-time requests and responses, ensuring quick and efficient execution.</li><li><strong>Event Channel</strong> is tailored for continuous data streams, enabling real-time updates and notifications within the Flutter app.</li></ul><h3>Example: Implementing Method Channel</h3><h4>Flutter Side</h4><p>First, create a Method Channel in your Flutter code.</p><pre>import &#39;package:flutter/services.dart&#39;;<br><br>class MethodChannelExample {<br>  static const platform = MethodChannel(&#39;com.example.methodchannel/sample&#39;);<br><br>  Future&lt;void&gt; callNativeMethod() async {<br>    try {<br>      final int result = await platform.invokeMethod(&#39;getNativeData&#39;);<br>      print(&quot;Result from native: $result&quot;);<br>    } on PlatformException catch (e) {<br>      print(&quot;Failed to get data: &#39;${e.message}&#39;.&quot;);<br>    }<br>  }<br>}</pre><h4>Android Native Side (Kotlin)</h4><p>Next, implement the corresponding method in the native Android code.</p><pre>package com.example.methodchannel<br><br>import io.flutter.embedding.android.FlutterActivity<br>import io.flutter.plugin.common.MethodChannel<br><br>class MainActivity: FlutterActivity() {<br>    private val CHANNEL = &quot;com.example.methodchannel/sample&quot;<br><br>    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {<br>        super.configureFlutterEngine(flutterEngine)<br>        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {<br>            call, result -&gt;<br>            if (call.method == &quot;getNativeData&quot;) {<br>                val nativeData = getNativeData()<br>                if (nativeData != null) {<br>                    result.success(nativeData)<br>                } else {<br>                    result.error(&quot;UNAVAILABLE&quot;, &quot;Native data not available.&quot;, null)<br>                }<br>            } else {<br>                result.notImplemented()<br>            }<br>        }<br>    }<br><br>    private fun getNativeData(): Int {<br>        // Your logic to get native data<br>        return 42<br>    }<br>}</pre><h3>Example: Implementing Event Channel</h3><h4>Flutter Side</h4><p>For the Event Channel, set up a listener in your Flutter code.</p><pre>import &#39;package:flutter/services.dart&#39;;<br><br>class EventChannelExample {<br>  static const EventChannel eventChannel = EventChannel(&#39;com.example.eventchannel/sample&#39;);<br><br>  void startListening() {<br>    eventChannel.receiveBroadcastStream().listen((dynamic event) {<br>      print(&quot;Event from native: $event&quot;);<br>    }, onError: (dynamic error) {<br>      print(&quot;Error: $error&quot;);<br>    });<br>  }<br>}</pre><h4>Android Native Side (Kotlin)</h4><p>Implement the Event Channel on the native side.</p><pre>package com.example.eventchannel<br><br>import io.flutter.embedding.android.FlutterActivity<br>import io.flutter.plugin.common.EventChannel<br><br>class MainActivity: FlutterActivity() {<br>    private val CHANNEL = &quot;com.example.eventchannel/sample&quot;<br>    private var events: EventChannel.EventSink? = null<br><br>    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {<br>        super.configureFlutterEngine(flutterEngine)<br>        EventChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setStreamHandler(<br>            object : EventChannel.StreamHandler {<br>                override fun onListen(arguments: Any?, events: EventChannel.EventSink?) {<br>                    this@MainActivity.events = events<br>                    startSendingEvents()<br>                }<br><br>                override fun onCancel(arguments: Any?) {<br>                    this@MainActivity.events = null<br>                }<br>            }<br>        )<br>    }<br><br>    private fun startSendingEvents() {<br>        // Simulating sending events periodically<br>        Timer().scheduleAtFixedRate(object : TimerTask() {<br>            override fun run() {<br>                events?.success(&quot;Event data from native&quot;)<br>            }<br>        }, 0, 1000)<br>    }<br>}</pre><h3>Use Cases 💡</h3><h4>Use Cases for Method Channel</h4><ul><li><strong>Device Information</strong>: Fetching device-specific information like battery level or system version.</li><li><strong>One-Time Configuration</strong>: Setting up configurations that require a single call and response.</li><li><strong>Native UI Components</strong>: Interacting with native UI components or services like dialogs or notifications.</li></ul><h4>Use Cases for Event Channel</h4><ul><li><strong>Sensor Data</strong>: Continuously receiving updates from device sensors like accelerometer, gyroscope, etc.</li><li><strong>Real-Time Notifications</strong>: Listening for real-time updates or notifications from a native service.</li><li><strong>Location Updates</strong>: Tracking location changes continuously in the background.</li></ul><h3>Conclusion 📰</h3><p>In Flutter, Method Channel and Event Channel are indispensable tools for integrating with native platform functionalities. They offer a flexible and powerful way to extend the capabilities of your Flutter applications by leveraging native code. Whether you need to make a one-time request or listen to continuous data streams, these channels provide a seamless and efficient solution. Understanding and effectively implementing them can significantly enhance the functionality and user experience of your Flutter apps.</p><ul><li><a href="https://medium.com/@adityagmhatre/fixing-flutter-3-22-app-localization-deleted-after-dart-tun-on-macos-6dbcc80e8041">Fixing Flutter 3.22 app_localization deleted after dart tun on macOS</a></li><li><a href="https://medium.com/@adityagmhatre/flutter-3-22-update-breaking-changes-in-colorscheme-59ffb3131276">Flutter 3.22 Update: Breaking Changes in ColorScheme</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9134d6a8ceba" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/understanding-event-channel-and-method-channel-in-flutter-and-dart-9134d6a8ceba">Understanding Event &amp; Method Channel in Flutter</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing Flutter 3.22 app_localization deleted after dart tun on macOS]]></title>
            <link>https://blog.stackademic.com/fixing-flutter-3-22-app-localization-deleted-after-dart-tun-on-macos-6dbcc80e8041?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dbcc80e8041</guid>
            <category><![CDATA[app-localization]]></category>
            <category><![CDATA[flutter-322]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Mon, 27 May 2024 06:53:44 GMT</pubDate>
            <atom:updated>2024-05-28T00:25:07.053Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*aAZiKtBuY2wVSiTh2OHv7g.png" /></figure><h3>Introduction 🌅</h3><p>As Flutter continues to evolve, developers occasionally encounter bugs that disrupt their workflow. Recently, a bug in Flutter 3.22 has been causing headaches for developers using both Apple Silicon and Intel Macs. This issue, which affects localization (l10n) files generated by flutter-gen, leads to their deletion after running the dart run command. This problem also extends to CI/CD pipelines, causing build failures in GitHub Actions.</p><p>In this article, we’ll delve into the specifics of this bug, its impact, and three potential resolutions to keep your Flutter development smooth and efficient.</p><h3>The Bug 🐞</h3><h4>Description</h4><p>When running the dart run, for example dart run build_runner build -d command on Flutter 3.22, the l10n files generated by flutter-gen are unexpectedly deleted. This issue has been observed on both Apple Silicon and Intel Silicon Macs, disrupting the normal workflow and causing build failures, particularly in automated environments like GitHub Actions.</p><h4>Impact</h4><ul><li><strong>Local Development:</strong> Developers need to regenerate l10n files manually, adding an extra step to their workflow.</li><li><strong>CI/CD Pipelines:</strong> The deletion of these files leads to failed builds, as the necessary localization data is missing, causing errors and build breaks.</li></ul><h3>Resolutions</h3><p>Here are four ways to resolve this issue:</p><h4>Option 1: Downgrade Flutter Version to 3.19.6</h4><p>One straightforward solution is to downgrade your Flutter version to 3.19.6, where this issue does not occur.</p><p><strong>Install Flutter 3.19.6:</strong></p><pre>flutter downgrade 3.19.6</pre><h4>Option 2: Run flutter pub get After dart run</h4><p>Another solution is to run the flutter pub get command after executing dart run. This will regenerate the l10n files.</p><p><strong>Run Your Dart Command:</strong></p><pre>dart run build_runner build -d</pre><p><strong>Regenerate l10n Files:</strong></p><pre>flutter pub get</pre><h4>Solution for GitHub Actions</h4><p>To ensure smooth builds, you can add a step to your GitHub Actions workflow to run flutter pub get after dart run.</p><pre>name: Flutter CI<br><br>on:<br>  push:<br>    branches: [ main ]<br>  pull_request:<br>    branches: [ main ]<br><br>jobs:<br>  build:<br>    runs-on: macos-latest<br><br>    steps:<br>    - uses: actions/checkout@v2<br>    - name: Set up Flutter<br>      uses: subosito/flutter-action@v1<br>      with:<br>        flutter-version: &#39;3.22.0&#39;<br><br>    - name: Install dependencies<br>      run: flutter pub get<br><br>    - name: Run Dart command<br>      run: dart run build_runner build -d<br><br>    - name: Regenerate l10n files<br>      run: flutter pub get<br><br>    - name: Build<br>      run: flutter build apk</pre><p>This workflow ensures that the l10n files are always present before the build step, preventing build failures due to this bug.</p><h4>Option 3: Upgrade to Hotfix 3.22.1</h4><p>Flutter has released a hotfix (3.22.1) that addresses this issue. Upgrading to this version can resolve the bug without additional steps.</p><p><strong>Upgrade the version</strong></p><pre>flutter upgrade</pre><p>By upgrading to the latest hotfix, you can benefit from the bug fix while enjoying the latest features and improvements in Flutter.</p><h4>Option 4: disable Synthetic package in l10n.yaml</h4><p>A more customizable solution is to disable synthetic package generation for l10n files and specify a custom path in your l10n.yaml file. This can prevent the files from being deleted and allow you to manage their location more effectively.</p><p><strong>Modify </strong><strong>l10n.yaml:</strong> Update your l10n.yaml file to disable synthetic package generation and set a custom output directory.</p><pre>arb-dir: lib/l10n<br>template-arb-file: app_en.arb<br>output-localization-file: app_localizations.dart<br>synthetic-package: false<br>output-dir: lib/generated/l10n</pre><p><strong>Generate l10n Files:</strong> Run the following command to generate l10n files in the specified directory.</p><pre>flutter gen-l10n</pre><p><strong>Update Imports:</strong> Update the import paths in your Dart files to match the new location of the generated l10n files.</p><p>This approach gives you more control over where the l10n files are stored and prevents them from being inadvertently deleted.</p><h3>Conclusion 📰</h3><p>While bugs like the l10n file deletion in Flutter 3.22 can disrupt development, understanding and implementing effective resolutions can mitigate their impact. Whether you choose to downgrade Flutter, manually regenerate files, or upgrade to a hotfix, these solutions will help maintain a smooth development workflow and successful CI/CD pipelines.</p><p>Stay updated with Flutter releases and community forums to catch and address such issues early in your development process. Happy coding!</p><ul><li><a href="https://blog.stackademic.com/flutter-3-22-update-breaking-changes-in-colorscheme-59ffb3131276">Flutter 3.22 Update: Breaking Changes in ColorScheme</a></li><li><a href="https://blog.stackademic.com/exploring-cupertinolistsection-in-flutter-16b912231094">Exploring CupertinoListSection in Flutter</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>Tired of blogging platforms that force you to deal with algorithmic content? Try <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dbcc80e8041" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/fixing-flutter-3-22-app-localization-deleted-after-dart-tun-on-macos-6dbcc80e8041">Fixing Flutter 3.22 app_localization deleted after dart tun on macOS</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter 3.22 Update: Breaking Changes in ColorScheme]]></title>
            <link>https://blog.stackademic.com/flutter-3-22-update-breaking-changes-in-colorscheme-59ffb3131276?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/59ffb3131276</guid>
            <category><![CDATA[flutter-3]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[color-scheme]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Sun, 19 May 2024 13:03:08 GMT</pubDate>
            <atom:updated>2024-05-20T01:30:05.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*oR0TRVVNEVmewGO9NrROQg.png" /></figure><h3>Introduction 🌅</h3><p>With the release of Flutter 3.22.0, developers are introduced to significant updates and breaking changes in the ColorScheme class. These changes are in line with the latest Material Design 3 guidelines, enhancing the flexibility and consistency of color theming in Flutter applications. This article delves into the new color roles, deprecated color roles, and provides a detailed migration guide to help developers adapt their existing codebases to the updated ColorScheme.</p><h3>Summary of Changes 📃</h3><h4>New Color Roles 🆕</h4><p>The updated ColorScheme now includes a set of new tone-based surfaces and containers, along with additional accent colors. These new roles are designed to provide more precise control over color theming, replacing the old opacity-based model with a more robust and adaptable approach. The new color roles include:</p><p><strong>Tone-based Surfaces and Containers:</strong></p><ul><li>surfaceBright</li><li>surfaceDim</li><li>surfaceContainer</li><li>surfaceContainerLow</li><li>surfaceContainerLowest</li><li>surfaceContainerHigh</li><li>surfaceContainerHighest</li></ul><h4>Deprecated Color Roles 🗑️</h4><p>Three existing color roles have been deprecated in favor of the new system:</p><ul><li>background</li><li>onBackground</li><li>surfaceVariant</li></ul><h4>Changes to ColorScheme.fromSeed 🎨</h4><p>The ColorScheme.fromSeed method has been updated to follow the latest algorithm from the Material color utilities package. This change ensures that the constructed ColorScheme aligns with Material Design 3 guidelines, preventing overly bright schemes even when using a bright seed color.</p><h3>Migration Guide 🚂</h3><h4>Adjusting to New Color Roles ⚙️</h4><p>Developers need to transition from the deprecated color roles to the new equivalents. The replacements are as follows:</p><ul><li>background -&gt; surface</li><li>onBackground -&gt; onSurface</li><li>surfaceVariant -&gt; surfaceContainerHighest</li></ul><p><strong>Before 3.22:</strong></p><pre>final ColorScheme colorScheme = ColorScheme();<br>MaterialApp(<br>  theme: ThemeData(<br>    //...<br>    colorScheme: colorScheme.copyWith(<br>      background: myColor1,<br>      onBackground: myColor2,<br>      surfaceVariant: myColor3,<br>    ),<br>  ),<br>  //...<br>)</pre><p><strong>From 3.22:</strong></p><pre>final ColorScheme colorScheme = ColorScheme();<br>MaterialApp(<br>  theme: ThemeData(<br>    //...<br>    colorScheme: colorScheme.copyWith(<br>      surface: myColor1,<br>      onSurface: myColor2,<br>      surfaceContainerHighest: myColor3,<br>    ),<br>  ),<br>  //...<br>)</pre><h4>Updating Custom Components ⬆️</h4><p>For custom components that used to access the deprecated color roles, update the color lookups accordingly:</p><p><strong>Before 3.22:</strong></p><pre>Color myColor1 = Theme.of(context).colorScheme.background;<br>Color myColor2 = Theme.of(context).colorScheme.onBackground;<br>Color myColor3 = Theme.of(context).colorScheme.surfaceVariant;</pre><p><strong>From 3.22:</strong></p><pre>Color myColor1 = Theme.of(context).colorScheme.surface;<br>Color myColor2 = Theme.of(context).colorScheme.onSurface;<br>Color myColor3 = Theme.of(context).colorScheme.surfaceContainerHighest;</pre><h4>Handling Bright Seed Colors 🛞</h4><p>When using ColorScheme.fromSeed with a bright seed color, the updated method might generate a slightly darker scheme. To maintain the brightness, use the FromSeedVariant.fidelity parameter:</p><p><strong>Before 3.22:</strong></p><pre>ColorScheme.fromSeed(seedColor: Color(0xFF0000FF))</pre><p><strong>From 3.22:</strong></p><pre>ColorScheme.fromSeed(<br>    seedColor: Color(0xFF0000FF),<br>    schemeVariant: FromSeedVariant.fidelity,<br>)</pre><h3>Impact on Widgets 🔨</h3><h4>Elimination of surfaceTintColor ❌</h4><p>The changes in the ColorScheme help eliminate the use of widgets&#39; surfaceTintColor, which was previously used to apply a tinted overlay on top of surfaces based on their elevation. The new tone-based surface colors replace this old opacity-based model, simplifying and standardizing the appearance of elevated surfaces.</p><h4>Default Values for Widgets 🦴</h4><p>The default surfaceTintColor for all widgets is now set to null, and their default background color is based on the new tone-based surface colors. This affects various widgets including Card, NavigationBar, and AppBar, ensuring they automatically adapt to the updated ColorScheme without requiring additional tint overlays.</p><h4>Remediation 🛠️</h4><p>If developers still want SurfaceTint like before on these widgets, they now have to manaully define surfaceTintColor.</p><pre>ThemeData(<br>  cardTheme: CardTheme(surfaceTintColor: colorScheme.surfaceTint),<br>)</pre><h3>Conclusion 📰</h3><p>The changes introduced in Flutter 3.22.0 align the framework with the latest Material Design 3 guidelines, providing a more nuanced and adaptable color theming system. By following the migration guide outlined above, developers can seamlessly transition their applications to utilize the new ColorScheme roles and methods, ensuring compatibility and enhancing the visual consistency of their Flutter applications.</p><ul><li><a href="https://blog.stackademic.com/exploring-cupertinolistsection-in-flutter-16b912231094">Exploring CupertinoListSection in Flutter</a></li><li><a href="https://blog.stackademic.com/seamless-swiping-pageview-in-flutter-75caddff95e7">Seamless Swiping: PageView in Flutter</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>Tired of blogging platforms that force you to deal with algorithmic content? Try <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59ffb3131276" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/flutter-3-22-update-breaking-changes-in-colorscheme-59ffb3131276">Flutter 3.22 Update: Breaking Changes in ColorScheme</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring CupertinoListSection in Flutter]]></title>
            <link>https://blog.stackademic.com/exploring-cupertinolistsection-in-flutter-16b912231094?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/16b912231094</guid>
            <category><![CDATA[cupertino]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Sat, 11 May 2024 14:08:09 GMT</pubDate>
            <atom:updated>2024-05-13T00:22:10.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*DS1bEt2wFNzL8Bdq0CUIPw.png" /></figure><h3>Introduction 🌅</h3><p>Flutter’s Cupertino design language offers developers a set of widgets and components that align with Apple’s Human Interface Guidelines (HIG), facilitating the creation of iOS-styled apps seamlessly. Among these widgets,CupertinoListSection &amp; CupertinoListSection.insetGroupedstand out as powerful tools for organizing and presenting data within lists. In this comprehensive guide, we’ll dive deep into these widgets, exploring their features, use cases, and various properties for customization.</p><h3>Understanding CupertinoListSection 📃</h3><p>CupertinoListSectionserves as a widget to partition a list into sections, offering a visually organized layout for your content. It becomes particularly handy when dealing with extensive datasets that need categorization into distinct groups.</p><h4>Key Features of CupertinoListSection: 💡</h4><ol><li><strong>Section Headers</strong>: CupertinoListSectionallows for the inclusion of headers for each section, providing clear visual separation between different groups of items within the list.</li><li><strong>Customization</strong>: You can customize the appearance of section headers using properties like headerBuilder, header, or headerTextStyle, enabling you to match the styling of your app&#39;s theme or design specifications effortlessly.</li><li><strong>Separators</strong>: By default, CupertinoListSectionautomatically adds separators between sections, enhancing the visual clarity and organization of the list.</li><li><strong>Scroll Behavior</strong>: CupertinoListSectionseamlessly integrates with Flutter’s scrolling system, ensuring smooth performance even with large datasets.</li><li><strong>Expansion Support</strong>: Sections can be made expandable, allowing users to toggle visibility between collapsed and expanded states, which is particularly useful for presenting hierarchical data.</li></ol><h4>Implementing CupertinoListSection 🔨</h4><p>Let’s explore a basic implementation of CupertinoListSectionin Flutter:</p><pre>CupertinoListSection(<br>  header: Text(&#39;Section Header&#39;),<br>  children: &lt;Widget&gt;[<br>    CupertinoListTile(title: Text(&#39;Item 1&#39;)),<br>    CupertinoListTile(title: Text(&#39;Item 2&#39;)),<br>    CupertinoListTile(title: Text(&#39;Item 3&#39;)),<br>  ],<br>);</pre><p>In this example, we’re creating a simple CupertinoListSectionwith three sections, each containing a CupertinoListTile as a placeholder for the section’s content. You can replace the CupertinoListTilewidgets with any other widgets you need for your specific use case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*lQDPiJKGeKrYjNfZ9frgkA.png" /></figure><h3>Exploring CupertinoListSection.insetGrouped 📃</h3><p>CupertinoListSection.insetGroupedextends the functionality of CupertinoListSection by providing an inset grouped style, similar to the appearance of grouped table views in iOS.</p><h4>Key Features of CupertinoListSection.insetGrouped: 💡</h4><ol><li><strong>Inset Appearance</strong>: This variant of CupertinoListSectionadds inset styling to the sections, resulting in a grouped layout with rounded corners and inset margins.</li><li><strong>Consistent iOS Aesthetics</strong>: The inset grouped style aligns with iOS design conventions, providing users with a familiar and intuitive interface.</li><li><strong>Easy Configuration</strong>: Implementing inset grouped sections is straightforward, requiring minimal configuration to achieve a polished appearance.</li></ol><h4>Implementing CupertinoListSection.insetGrouped 🔨</h4><p>Here’s how you can integrate CupertinoListSection.insetGroupedinto your Flutter app:</p><pre>CupertinoListSection.insetGrouped(<br>  header: Text(&#39;Section Header&#39;),<br>  children: &lt;Widget&gt;[<br>    CupertinoListTile(title: Text(&#39;Item 1&#39;)),<br>    CupertinoListTile(title: Text(&#39;Item 2&#39;)),<br>    CupertinoListTile(title: Text(&#39;Item 3&#39;)),<br>  ],<br>);</pre><p>In this example, we’re creating a grouped section with a header and three list items. The resulting layout will resemble a grouped table view commonly seen in iOS apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*Xy0F96QRgOYkoAEhH771Mg.png" /></figure><h3>Customization Properties 🎨</h3><p>Both CupertinoListSection &amp; CupertinoListSection.insetGrouped offer several properties for customization:</p><ol><li><strong>header</strong>: Customize section headers using header.</li><li><strong>footer: </strong>Customize section footers using footer<strong>.</strong></li><li><strong>separatorColor</strong>: Adjust separator appearance using separatorColor.</li><li><strong>backgroundColor</strong>: Set background color for the entire section using backgroundColor.</li><li><strong>margin:</strong> Sets the spacing around the content area of the section.</li><li><strong>hasLeading:</strong> Whether children contains leading or not.</li></ol><h3>Best Practices and Considerations 🧑🏻‍🏫</h3><ol><li><strong>Consistency</strong>: Maintain consistency in styling and layout across your app for a cohesive user experience.</li><li><strong>Performance</strong>: Optimize list performance, especially with large datasets, by implementing efficient data loading and rendering strategies.</li><li><strong>Accessibility</strong>: Ensure your lists are accessible to all users by providing appropriate labels and support for assistive technologies.</li><li><strong>Testing</strong>: Thoroughly test your lists across different devices and screen sizes to verify responsiveness and compatibility.</li></ol><h3>Conclusion 📰</h3><p>By leveraging CupertinoListSection &amp; CupertinoListSection.insetGrouped along with their customization properties effectively, you can create intuitive, visually appealing lists that enhance the user experience of your Flutter app significantly. Experiment with different configurations and styles to find the best fit for your specific use cases and design preferences.</p><ul><li><a href="https://blog.stackademic.com/understanding-navigationrail-in-flutter-ced5ff605378">Understanding NavigationRail in Flutter</a></li><li><a href="https://blog.stackademic.com/unpacking-navigationbar-in-flutter-an-in-depth-look-bcad10f8dc64">Unpacking NavigationBar in Flutter: An In-depth Look</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>Tired of blogging platforms that force you to deal with algorithmic content? Try <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16b912231094" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/exploring-cupertinolistsection-in-flutter-16b912231094">Exploring CupertinoListSection in Flutter</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding NavigationRail in Flutter]]></title>
            <link>https://blog.stackademic.com/understanding-navigationrail-in-flutter-ced5ff605378?source=rss-e588bc4bedd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ced5ff605378</guid>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[navigationrail]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Aditya Mhatre]]></dc:creator>
            <pubDate>Sun, 28 Apr 2024 17:32:40 GMT</pubDate>
            <atom:updated>2024-04-30T00:46:56.539Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*dDTo8FLVrZ1MD-GI8VCS7w.png" /></figure><p>Flutter’s NavigationRail widget offers a vertical alternative to the standard bottom navigation, providing an intuitive way to navigate through different sections of a Flutter application. A navigation rail is usually used as the first or last element of a Row which defines the app’s Scaffold body.</p><h3>Introduction 🌅</h3><p>NavigationRail in Flutter is designed to be a highly customizable and versatile navigation solution. Unlike traditional bottom navigation, it aligns items vertically along the left or right edge of the screen, making it ideal for tablet applications, web apps, and large-screen devices. This flexibility allows developers to design unique navigation experiences while maintaining ease of use.</p><p>Vertical navigation is becoming increasingly popular, especially in applications with multiple sections or in scenarios where vertical space is more abundant than horizontal space. The NavigationRail widget is designed to address these needs.</p><h3>Why Use NavigationRail? 🤔</h3><p>NavigationRailcan be a game-changer in terms of usability and design flexibility. Here’s why it’s a valuable addition to your Flutter toolkit:</p><ul><li><strong>Space Efficiency</strong>: Vertical navigation conserves horizontal space, allowing more content on the screen.</li><li><strong>Adaptive Layouts</strong>: NavigationRailis excellent for apps that need to adapt to different screen sizes and orientations.</li><li><strong>Customizable Design</strong>: It offers various customization options to match your app’s theme and branding.</li></ul><h3>NavigationRail 🚈</h3><h4>Syntax ⚙️</h4><p>Here’s the basic syntax for creating a NavigationRail in a Flutter app:</p><pre>NavigationRail(<br>  backgroundColor: // Background color of the rail,<br>  elevation: // Elevation for the rail,<br>  extended: // Boolean indicating if the rail should be extended (showing labels),<br>  selectedIndex: // Index of the currently selected destination,<br>  onDestinationSelected: // Function called when a destination is selected,<br>  destinations: // List of NavigationRailDestination representing the rail&#39;s children,<br>  leading: // Optional widget to place at the top of the rail,<br>  trailing: // Optional widget to place at the bottom of the rail,<br>  labelType: // Determines when labels are shown (none, selected, or all),<br>  // Additional properties<br>)<br><br>NavigationRailDestination(<br>  icon: // Icon for the destination,<br>  selectedIcon: // Icon displayed when selected,<br>  label: // Label shown beside the icon,<br>)</pre><h4>Example</h4><p>Let’s examine a basic implementation of NavigationRail in a Flutter application:</p><pre>...<br>void onPressed(int index) {<br>  setState(() {<br>    selectedIndex = index;<br>  });<br>}<br>...<br>...<br><br>NavigationRail(<br>  selectedIndex: selectedIndex,<br>  onDestinationSelected: onPressed,<br>  elevation: 1,<br>  backgroundColor: context.colors.surface,<br>  extended: false,<br>  destinations: [<br>    List.generate(<br>      pages.length,<br>      (index) =&gt; NavigationRailDestination(<br>        con: Icon(pages[index].icon),<br>        selectedIcon: Icon(pages[index].selectedIcon),<br>        label: pages[index].name(context),<br>      ),<br>    ),<br>  ],<br>),<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*KsnCXaQEoIoCHaaX6m24tQ.gif" /></figure><h3>Best Practices 🪴</h3><p>To maximize the benefits of NavigationRail, consider the following best practices:</p><ul><li><strong>Use NavigationRail in Larger Layouts</strong>: It’s ideal for larger screens, tablets, or when creating adaptive layouts.</li><li><strong>Keep Destinations Simple</strong>: Use clear icons and labels to represent each section.</li><li><strong>Experiment with the </strong><strong>extended Property</strong>: Try different configurations to find what works best for your app.</li><li><strong>Utilize Leading and Trailing Widgets</strong>: These can be used for additional controls, like profile pictures or settings icons.</li><li><strong>Ensure Smooth Transitions</strong>: Maintain a seamless user experience when switching between sections.</li></ul><h3>Conclusion 📰</h3><p>Flutter’s NavigationRail widget is a versatile tool for creating vertical navigation in your applications. With its customization options and ability to adapt to various screen sizes, it can significantly improve the navigation experience. By following best practices and keeping the design consistent, you can create a user-friendly and intuitive interface for your app’s users.</p><ul><li><a href="https://blog.stackademic.com/unpacking-navigationbar-in-flutter-an-in-depth-look-bcad10f8dc64">Unpacking NavigationBar in Flutter: An In-depth Look</a></li><li><a href="https://blog.stackademic.com/seamless-swiping-pageview-in-flutter-75caddff95e7">Seamless Swiping: PageView in Flutter</a></li></ul><p>Thanks for reading. If you found this article to be helpful please share it with your friends.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ced5ff605378" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/understanding-navigationrail-in-flutter-ced5ff605378">Understanding NavigationRail in Flutter</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>