<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ethiel ADIASSA</title>
    <description>The latest articles on Forem by Ethiel ADIASSA (@ethiel97).</description>
    <link>https://forem.com/ethiel97</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F73223%2Ff5e4d952-7b59-4fca-9006-328ac5bbd5fa.png</url>
      <title>Forem: Ethiel ADIASSA</title>
      <link>https://forem.com/ethiel97</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ethiel97"/>
    <language>en</language>
    <item>
      <title>LucidClip — Building a production-grade desktop clipboard manager with faster iteration using GitHub Copilot CLI</title>
      <dc:creator>Ethiel ADIASSA</dc:creator>
      <pubDate>Mon, 16 Feb 2026 04:25:13 +0000</pubDate>
      <link>https://forem.com/ethiel97/lucidclip-building-a-production-grade-desktop-clipboard-manager-with-faster-iteration-using-4o3n</link>
      <guid>https://forem.com/ethiel97/lucidclip-building-a-production-grade-desktop-clipboard-manager-with-faster-iteration-using-4o3n</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F795k1zz4kgmvjzasodk6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F795k1zz4kgmvjzasodk6.png" alt="LucidClip Screenshot" width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/github-2026-01-21"&gt;GitHub Copilot CLI Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;LucidClip&lt;/strong&gt;, a production-grade, privacy-first clipboard manager for macOS designed for developers and power users.&lt;/p&gt;

&lt;p&gt;Clipboard interaction is one of the most frequent workflows on any system, yet most solutions compromise performance, privacy, or UX discipline.&lt;/p&gt;

&lt;p&gt;LucidClip was engineered with strict architectural constraints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local-first data model, clipboard history remains on-device
&lt;/li&gt;
&lt;li&gt;Predictable performance, optimized for instant retrieval
&lt;/li&gt;
&lt;li&gt;Clean architecture boundaries: UI, domain, and persistence are clearly separated
&lt;/li&gt;
&lt;li&gt;Production reliability, designed for real-world desktop runtime conditions
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LucidClip is a commercial desktop application and its core implementation is private.&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://lucidclip.app" rel="noopener noreferrer"&gt;https://lucidclip.app&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Platform: macOS/Windows Desktop Application&lt;br&gt;&lt;br&gt;
Status: Production-ready  &lt;/p&gt;

&lt;p&gt;This project required solving real-world engineering challenges across system integration, runtime behavior, packaging, and release workflows.&lt;/p&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Product walkthrough:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Video walkthrough (recommended): &lt;a href="https://www.loom.com/share/ae9fb7a0e45c4d6ca2bb805f8aaf5304" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Download / Install instructions: &lt;a href="https://lucidclip.app/download" rel="noopener noreferrer"&gt;Download and Install&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LucidClip is accessible via &lt;em&gt;CMD + Shift + L&lt;/em&gt; shortcut after installation. Use the shortcut to toggle its window.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The demo shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Real-time clipboard capture
&lt;/li&gt;
&lt;li&gt;Instant search and retrieval
&lt;/li&gt;
&lt;li&gt;Fast interaction loop
&lt;/li&gt;
&lt;li&gt;Stable production runtime behavior
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This reflects real production usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Experience with GitHub Copilot CLI
&lt;/h2&gt;

&lt;p&gt;I used &lt;strong&gt;GitHub Copilot CLI&lt;/strong&gt; as a “terminal-native pair engineer”, not to replace engineering judgment, but to &lt;strong&gt;compress iteration loops&lt;/strong&gt; across exploration, debugging, and documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Turning unknowns into executable options
&lt;/h3&gt;

&lt;p&gt;When facing ambiguous implementation choices (e.g., macOS permissions, packaging constraints, CI friction), Copilot CLI helped me quickly produce &lt;strong&gt;decision options&lt;/strong&gt; I could validate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Explain what this error means and likely root causes&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Propose 3 fixes ordered by probability and risk&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Generate a minimal reproduction strategy&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Result: less time stuck in “search-and-guess”, more time in &lt;strong&gt;testable hypotheses&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) Debugging with structured terminal conversations
&lt;/h3&gt;

&lt;p&gt;For build/packaging errors, Copilot CLI was effective at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;interpreting verbose logs,&lt;/li&gt;
&lt;li&gt;suggesting targeted checks (paths, entitlements, sandboxing, signing),&lt;/li&gt;
&lt;li&gt;proposing remediation steps in an order that matches how macOS builds actually fail.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was especially useful because desktop failures are often &lt;strong&gt;environmental&lt;/strong&gt;, not purely code-level.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Accelerating “boring but critical” engineering work
&lt;/h3&gt;

&lt;p&gt;Copilot CLI shined for high-leverage tasks that are essential but time-consuming:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;release notes drafts,&lt;/li&gt;
&lt;li&gt;changelog formatting,&lt;/li&gt;
&lt;li&gt;installation docs,&lt;/li&gt;
&lt;li&gt;test plans,&lt;/li&gt;
&lt;li&gt;“how to reproduce” steps for issues.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice, it reduced overhead and improved clarity, which directly improves maintainability and judgeability.&lt;/p&gt;

&lt;h3&gt;
  
  
  4) Where I did NOT rely on Copilot
&lt;/h3&gt;

&lt;p&gt;I intentionally kept core decisions human-driven:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;architecture boundaries,&lt;/li&gt;
&lt;li&gt;product UX trade-offs,&lt;/li&gt;
&lt;li&gt;privacy posture,&lt;/li&gt;
&lt;li&gt;feature prioritization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Copilot CLI accelerated execution, but the “shape” of the product stayed intentional.&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;LucidClip represents a complete production-grade desktop engineering effort, spanning architecture, system integration, debugging, packaging, and release.&lt;/p&gt;

&lt;p&gt;GitHub Copilot CLI played a meaningful role in accelerating iteration, reducing debugging friction, and improving overall engineering throughput.&lt;/p&gt;

&lt;p&gt;Its greatest strength lies in helping engineers move faster through uncertainty, particularly at the system and operational level.&lt;/p&gt;

&lt;p&gt;This allowed development effort to remain focused on architecture, performance, and product quality, where engineering precision delivers the most impact.&lt;/p&gt;

&lt;p&gt;Thanks for reviewing. I’m happy to answer any technical questions about macOS desktop architecture, privacy constraints, or product design trade-offs.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
      <category>cli</category>
      <category>githubcopilot</category>
    </item>
    <item>
      <title>Always depend on Abstractions, a Dart example.</title>
      <dc:creator>Ethiel ADIASSA</dc:creator>
      <pubDate>Mon, 15 Jan 2024 13:18:19 +0000</pubDate>
      <link>https://forem.com/ethiel97/always-depend-on-abstractions-a-dart-example-1ik0</link>
      <guid>https://forem.com/ethiel97/always-depend-on-abstractions-a-dart-example-1ik0</guid>
      <description>&lt;p&gt;Abstractions provide a layer of separation between complex underlying details and higher-level functionalities.&lt;/p&gt;

&lt;p&gt;In Software Engineering it is always stated and recommended to depend on abstractions rather than concretions. It means your modules should not rely on concrete implementations, on the contrary, they must know no implementation details, complexity, or underlying mechanism of their dependencies. This complies with the Dependency Inversion Principle (DIP) of SOLID. &lt;/p&gt;

&lt;p&gt;By programming to abstractions rather than concrete implementations, Dart developers can &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create code that is decoupled and easy to maintain;&lt;/li&gt;
&lt;li&gt;write more reusable code by encapsulating common functionalities;&lt;/li&gt;
&lt;li&gt;write unit tests easily and efficiently ;&lt;/li&gt;
&lt;li&gt;write code adaptable to change, shielded from the need to make extensive changes throughout the codebase. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, let's dive into a practical example with explanations. For this, we'll use Dart programming language.&lt;/p&gt;

&lt;p&gt;Let's say you were to write a simple app to send SMS keeping in mind the principle we've seen above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SmsSender&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;sendSms&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, we have an abstraction of our SMS sender, it sets common functionalities every SMS sender should have. This is an abstract class and cannot be instantiated, but every &lt;code&gt;SmsSender&lt;/code&gt; (child) should implement the &lt;code&gt;sendSms&lt;/code&gt; method and define its low-level implementation details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TwilioSender&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="n"&gt;SmsSender&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

   &lt;span class="nd"&gt;@override&lt;/span&gt;
   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;sendSms&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//your sms complex logic :)&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;TwilioSender&lt;/code&gt; is a &lt;code&gt;SmsSender&lt;/code&gt;, hence must implement &lt;code&gt;sendSms&lt;/code&gt; method. It can be used interchangeably with its parent class without any unexpected behavior.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SmsService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;SmsSender&lt;/span&gt; &lt;span class="n"&gt;smsSender&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="n"&gt;SmsService&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
     &lt;span class="kd"&gt;required&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;smsSender&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;


   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;sendSms&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="n"&gt;smsSender&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sendSms&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;from:&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;to:&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we have a dedicated service to send an SMS that depends on our abstract &lt;code&gt;SmsSender&lt;/code&gt; class, which can be a Twilio sender or any of your choice. This is called &lt;a href="https://en.wikipedia.org/wiki/Dependency_injection"&gt;Dependency Injection&lt;/a&gt;.  This is the most important aspect since the &lt;code&gt;SmsService&lt;/code&gt; module doesn't depend on any concrete implementation of &lt;code&gt;SmsSender&lt;/code&gt;. This enables further scalability and adaptability to change. &lt;/p&gt;

&lt;p&gt;Let's see a simple usage of those classes. &lt;/p&gt;

&lt;p&gt;NB: I'm not using a dedicated dependency injection library and leaving some implementations for the sake of simplicity&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;

  &lt;span class="c1"&gt;//inject TwilioSender inside SmsService&lt;/span&gt;
  &lt;span class="n"&gt;SmsService&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SmsService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TwilioSender&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

  &lt;span class="n"&gt;smsService&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sendSms&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;to:&lt;/span&gt; &lt;span class="s"&gt;'+22809453945'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;from:&lt;/span&gt; &lt;span class="s"&gt;'+2250503244804'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The TwilioSender can easily be replaced later by any other SMS sender. The &lt;code&gt;SmsService&lt;/code&gt; doesn't and needs not to know the implementation details of an SMS sender, it simply wants to send an SMS. &lt;/p&gt;

&lt;p&gt;That's the beauty of this principle.&lt;/p&gt;

&lt;p&gt;In the complex and ever-changing field of software engineering, embracing abstractions is not merely a convenience but a necessity. Abstractions simplify complexity, enhance productivity, promote code reusability, and contribute to the maintainability and scalability of software systems.&lt;/p&gt;

&lt;p&gt;I hope you understand and will keep in mind this in your coding endeavor.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>dart</category>
      <category>solidprinciples</category>
      <category>dependencyinversion</category>
    </item>
    <item>
      <title>Intro to ValueNotifier, a simple yet efficient state management for Flutter apps.</title>
      <dc:creator>Ethiel ADIASSA</dc:creator>
      <pubDate>Sun, 14 May 2023 05:03:10 +0000</pubDate>
      <link>https://forem.com/ethiel97/intro-to-valuenotifier-a-simple-yet-efficient-state-management-for-flutter-apps-3di0</link>
      <guid>https://forem.com/ethiel97/intro-to-valuenotifier-a-simple-yet-efficient-state-management-for-flutter-apps-3di0</guid>
      <description>&lt;p&gt;Today, I'd like to talk to you about simple and reactive state management in Flutter with &lt;strong&gt;ValueNotifier&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;State management is an essential part of building any Flutter application, and there are several state management solutions available, such as Riverpod, Provider, Bloc, Redux, etc. However, in some cases, you may find that these solutions are too complex for your needs, and you'd prefer a simpler and more lightweight option. This is where ValueNotifier comes in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ValueNotifier&lt;/strong&gt; is a simple class that extends ChangeNotifier and provides a way to store a single value that can be listened to and updated reactively. It's perfect for simple state management needs and can be used with widgets that need to be rebuilt when the state changes.&lt;/p&gt;

&lt;p&gt;Here's a simple implementation example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CounterModel&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;ValueNotifier&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;CounterModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApp&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;StatelessWidget&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;CounterModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;MaterialApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="s"&gt;'ValueNotifier Demo'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;home:&lt;/span&gt; &lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;appBar:&lt;/span&gt; &lt;span class="n"&gt;AppBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'ValueNotifier Demo'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="nl"&gt;body:&lt;/span&gt; &lt;span class="n"&gt;Center&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nl"&gt;mainAxisAlignment:&lt;/span&gt; &lt;span class="n"&gt;MainAxisAlignment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;children:&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Widget&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;[&lt;/span&gt;
              &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s"&gt;'You have pushed the button this many times:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;ValueListenableBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;valueListenable:&lt;/span&gt; &lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nl"&gt;builder:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;child&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="si"&gt;$value&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;Theme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;textTheme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;headline4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
          &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="nl"&gt;floatingActionButton:&lt;/span&gt; &lt;span class="n"&gt;FloatingActionButton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;onPressed:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="nl"&gt;tooltip:&lt;/span&gt; &lt;span class="s"&gt;'Increment'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Icon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Icons&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;we define a CounterModel class that extends ValueNotifier and provides an increment() method to update the counter value;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;we then create an instance of CounterModel and pass it to the ValueListenableBuilder widget, which listens to changes in the counter value and rebuilds the widget tree whenever the value changes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using &lt;strong&gt;ValueNotifier&lt;/strong&gt; is that simple! It's a great choice for small to medium-sized projects where you don't need the complexity of other state management solutions. However, keep in mind that it may not be suitable for larger projects or projects with complex state management needs.&lt;/p&gt;

&lt;p&gt;In conclusion, &lt;strong&gt;ValueNotifier&lt;/strong&gt; is a simple and reactive way to manage state in your Flutter applications. It's easy to use and perfect for small to medium-sized projects. If you need something more powerful, there are several other state management solutions available in the Flutter ecosystem.&lt;br&gt;
I'll be writing soon a more advanced use case of the state management with &lt;strong&gt;ValueNotifier&lt;/strong&gt; in real-world projects. &lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>mobile</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Practical Intro to Operator Overloading in Dart</title>
      <dc:creator>Ethiel ADIASSA</dc:creator>
      <pubDate>Wed, 03 May 2023 01:28:04 +0000</pubDate>
      <link>https://forem.com/ethiel97/practical-intro-to-operator-overloading-in-dart-58eh</link>
      <guid>https://forem.com/ethiel97/practical-intro-to-operator-overloading-in-dart-58eh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Operator overloading is a quite powerful, popular, and common concept and feature in Object Oriented world. For people not familiar with that, it allows developers to redefine and customize the behavior of standard operators(+,-,%, etc) when used on user-created objects.&lt;br&gt;
Several object-oriented languages (like Dart, Java, C++,...) come with built-in support for it. &lt;/p&gt;

&lt;p&gt;In traditional programming, these operators are defined to work with built-in data types such as integers, floats, and strings. However, operator overloading allows you to define the behavior of these operators on your own objects. For example, if you have a class that represents complex numbers, you can define how the addition and subtraction operators work on instances of that class.  &lt;/p&gt;
&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ClassRoom operator + (Object o){
  //Your logic here
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here are some key points to note about the syntax:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the reserved keyword &lt;code&gt;operator&lt;/code&gt; and the specific operator we want to overload: the plus operator in this case: &lt;code&gt;+&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;the operands: &lt;code&gt;Object o&lt;/code&gt; is the right-hand side operand and the class we overload the operator on is the left-hand side one;&lt;/li&gt;
&lt;li&gt;the return type &lt;code&gt;ClassRoom&lt;/code&gt; the function should return. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that the concepts and syntax are clearly defined, let's get to a practical example. Let's assume we have a classroom with some students we want to keep track of. We also want to add new students to the classroom.&lt;/p&gt;

&lt;p&gt;We should have one class to represent the &lt;code&gt;ClassRoom&lt;/code&gt; and another one for the &lt;code&gt;User&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ClassRoom&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;ClassRoom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;students&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'Student{name: &lt;/span&gt;&lt;span class="si"&gt;$name&lt;/span&gt;&lt;span class="s"&gt; age: &lt;/span&gt;&lt;span class="si"&gt;$age&lt;/span&gt;&lt;span class="s"&gt;}'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's overload the + operator to fit our use case.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;ClassRoom&lt;/span&gt; &lt;span class="kd"&gt;operator&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;others&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,..&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;others&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ClassRoom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now your &lt;code&gt;Student&lt;/code&gt; class should look like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="n"&gt;ClassRoom&lt;/span&gt; &lt;span class="kd"&gt;operator&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;others&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,..&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;others&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ClassRoom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'Student{name: &lt;/span&gt;&lt;span class="si"&gt;$name&lt;/span&gt;&lt;span class="s"&gt;, age: &lt;/span&gt;&lt;span class="si"&gt;$age&lt;/span&gt;&lt;span class="s"&gt;}'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;the reserved keyword &lt;code&gt;operator&lt;/code&gt; and the specific operator we want to overload: the plus operator in this case: &lt;code&gt;+&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;the return type &lt;code&gt;ClassRoom&lt;/code&gt;, we add the current student to the list of the students and return it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From now on, every time we can use the plus operator like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;ClassRoom&lt;/span&gt; &lt;span class="n"&gt;classRoom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Andrew"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Jane"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if we print the &lt;code&gt;classRoom&lt;/code&gt; object, we should get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="n"&gt;Andrew&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;age:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="n"&gt;John&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;age:&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="n"&gt;Jane&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;age:&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Another example
&lt;/h2&gt;

&lt;p&gt;Now let's want to get the older student of the classroom. This will get us to overload another operator, it can be &lt;code&gt;&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;&lt;/code&gt; depending on your preference. We'll go with &lt;code&gt;&amp;gt;&lt;/code&gt; for simplicity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Student operator &amp;gt; (Student other){
    return age &amp;gt; other.age ? this : other;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax is pretty much the same.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the reserved keyword &lt;code&gt;operator&lt;/code&gt; and the specific overloaded operator &lt;code&gt;&amp;gt;&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;the return type &lt;code&gt;Student&lt;/code&gt;, we want to return the oldest student so we compare the current student's age with his comrade's one and return the greatest one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we can use our operator like the following:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Student oldest= classRoom.students.reduce((prev, student)=&amp;gt; prev &amp;gt; student );&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The reduce method reduces a list to a single value based on the provided function. We return the oldest student in the class room.&lt;/p&gt;

&lt;p&gt;If we print &lt;code&gt;oldest&lt;/code&gt;, we should get the expected result:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Student{name: Andrew, age: 20}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With those above examples we have seen how powerful operator overloading is and how concise and easier to read it can make our code by allowing you to use familiar operators with our custom objects. However, it's important to use operator overloading judiciously and with care, as it can lead to code that is difficult to understand and maintain if overused or used incorrectly.&lt;br&gt;
For additional resources you can head to the following links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dart.dev/language/classes"&gt;Dart official documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://subscription.packtpub.com/book/web-development/9781783989607/8/ch08lvl1sec53/operator-overloading-and-mixins"&gt;Packtpub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Acknowledgments
&lt;/h2&gt;

&lt;p&gt;Thanks to the author of this &lt;a href="https://medium.com/@dumazy/enhance-your-classes-with-operator-overloading-in-dart-f1124bd813a0"&gt;article&lt;/a&gt; since he's inspired mine. &lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>oop</category>
      <category>programming</category>
    </item>
    <item>
      <title>Smooth transition with text styles in Flutter</title>
      <dc:creator>Ethiel ADIASSA</dc:creator>
      <pubDate>Thu, 05 Sep 2019 23:56:53 +0000</pubDate>
      <link>https://forem.com/ethiel97/smooth-transition-with-text-styles-925</link>
      <guid>https://forem.com/ethiel97/smooth-transition-with-text-styles-925</guid>
      <description>&lt;p&gt;Hey folks! In this short article, I'll be showing you how to add a smooth transition between styles of the same text widget for example.&lt;/p&gt;

&lt;p&gt;First let's declare the initial style:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final TextStyle initialStyle = TextStyle(
  fontSize: 20.0,
  color: Colors.grey,
  fontWeight: FontWeight.bold,
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the final style:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final TextStyle finalStyle = TextStyle(
  fontSize: 22.0,
  color: Colors.black,
  fontWeight: FontWeight.bold,
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We'll also use a boolean to handle the state of our text widget, whether it's tapped or not:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var isTapped = false;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then, wrap the text widget inside &lt;code&gt;the AnimatedDefaultTextStyle&lt;/code&gt; widget to enable a transition between your styles. Last, you can wrap all this in the &lt;code&gt;InkWell&lt;/code&gt; widget with the boolean to switch between the styles on tap.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;InkWell(
        onTap: isTapped = !isTapped,
        child: AnimatedDefaultTextStyle(
          style: isTapped ? finalStyle : finalStyle,
          duration: const Duration(milliseconds: 500),
          child: Text(
           "Hello World"
          ),
        ),
      )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The image below summarizes all.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimgur.com%2FqwTYOUj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimgur.com%2FqwTYOUj.png" alt="Imgur"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all for this post. Thanks for your attention :)&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
    </item>
    <item>
      <title>Handle widgets visibility easily in Flutter</title>
      <dc:creator>Ethiel ADIASSA</dc:creator>
      <pubDate>Fri, 10 May 2019 13:21:30 +0000</pubDate>
      <link>https://forem.com/ethiel97/handle-widgets-visibility-easily-in-flutter-5501</link>
      <guid>https://forem.com/ethiel97/handle-widgets-visibility-easily-in-flutter-5501</guid>
      <description>&lt;p&gt;When it comes to manage your widgets visibility in Flutter, you have many options. Flutter provides us with some cool widgets for this purpose. Let's look at them :)&lt;/p&gt;

&lt;p&gt;Let's say you want to hide the following widget.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const child = Text("Hello World");&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Use Opacity widget
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    Opacity(
      opacity: 0.0,
      child: Container(
          child: child
      )
    );



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This widget simply sets the child's opacity to zero but still renders it. So the child is hidden but takes space and you can interact with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use Offstage widget
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    Offstage(
      offstage: true,
      child: child
      )
    );



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Offstage renders the child widget off set the screen. This means that the widget is not rendered in the subtree and so doesn't take any space.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Use Visibility widget
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    Visibility(
      visible: false,
      child: child
      )
    );



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here the child widget is not rendered in the subtree, and Flutter uses instead a shrinked sized box to replace it. The result is pretty much the same as with &lt;code&gt;Offstage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Use whatever you want as per as your needs.&lt;/p&gt;

&lt;p&gt;The image below summarizes all.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0f3cfmlyw72d1v85fda.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0f3cfmlyw72d1v85fda.png" alt="Imgur"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all for this post. Thanks :)&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>mobile</category>
    </item>
  </channel>
</rss>
