<?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 Surya on Medium]]></title>
        <description><![CDATA[Stories by Surya on Medium]]></description>
        <link>https://medium.com/@suryajillellamudi?source=rss-4f193276089f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DEHVvUpNZghXnEiAcQDC7w.jpeg</url>
            <title>Stories by Surya on Medium</title>
            <link>https://medium.com/@suryajillellamudi?source=rss-4f193276089f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 03:07:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@suryajillellamudi/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[Understanding the Lifecycle Methods of Stateful Widgets in Flutter]]></title>
            <link>https://medium.com/builtfordevs/understanding-the-lifecycle-methods-of-stateful-widgets-in-flutter-d27f1c4d0ff8?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d27f1c4d0ff8</guid>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[lifecycle-methods]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 06:23:01 GMT</pubDate>
            <atom:updated>2025-08-29T07:17:49.766Z</atom:updated>
            <content:encoded><![CDATA[<p>Not a Member? <a href="https://medium.com/@suryajillellamudi/understanding-the-lifecycle-methods-of-stateful-widgets-in-flutter-d27f1c4d0ff8?sk=e1023016833c8eb07327297b5fb47d6a">Click here</a></p><p>In Flutter, stateful widgets create dynamic user interfaces that can change over time. Unlike stateless widgets, stateful widgets can update their state based on user interactions or other events. Understanding how stateful widgets work, especially their l<strong>ifecycle methods</strong>, is important to ensure your app runs smoothly.</p><p>In this article, we’ll review the main lifecycle methods of stateful widgets in Flutter, explain each one&#39;s function, and show you when to use them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EkWeEzNQuvkwFW9ByoOEyw.png" /></figure><h3><strong>Lifecycle Methods of Stateful Widgets</strong></h3><p>Stateful widgets go through a series of lifecycle stages during their existence. These stages are managed through lifecycle methods, which are called in a specific order. Let’s explore the most commonly used lifecycle methods.</p><h4><strong>1. createState()</strong></h4><ul><li>When you create a stateful widget, the createState() method is called first. It is responsible for creating the <strong>mutable</strong> state for the widget. This is where you define the state class that will hold the <strong>data</strong> or <strong>variables</strong> that will change during the widget’s lifecycle.</li></ul><pre>@override<br>State&lt;MyWidget&gt; createState() =&gt; _MyWidgetState();</pre><h4><strong>2. initState()</strong></h4><ul><li>The initState() method is called <strong>right after</strong> the state for a widget is created, but before it is added to the screen.</li><li>It’s a good place to set up anything that only needs to happen <strong>once</strong>, like initializing variables or loading data from a server.</li><li>This method ensures that your widget is ready before it starts building its UI.</li></ul><pre>@override<br>void initState() {<br>  super.initState();<br>  // Initialization code<br>}</pre><ul><li><strong>Use case:</strong> Perfect for one-time setup like initializing data or animations that should happen before the widget builds.</li></ul><h4><strong>3. didChangeDependencies()</strong></h4><ul><li>The didChangeDependencies() is called immediately after initState() and whenever the dependencies of the state object change</li><li>For example, if you are using an InheritedWidget or Provider, this method will be called when the inherited data is <strong>updated</strong>.</li></ul><pre>@override<br>void didChangeDependencies() {<br>  super.didChangeDependencies();<br>  // Handle any changes in dependencies<br>}</pre><ul><li><strong>Use case:</strong> Useful when you need to respond to changes in dependencies (like data from a provider).</li></ul><h4><strong>4. build()</strong></h4><ul><li>The build() method is called whenever the widget’s <strong>state</strong> changes.</li><li>It creates the widget’s UI based on the current state.</li><li>Since it can be called many times, it’s important to keep it <strong>efficient</strong>.</li></ul><pre>@override<br>Widget build(BuildContext context) {<br>  return Container(<br>    child: Text(&#39;Current State Counter Value: $counterValue&#39;),<br>  );<br>}</pre><h4><strong>5. setState()</strong></h4><ul><li>While setState() is not technically a lifecycle method, it plays a key role in updating the state of a stateful widget.</li><li>Calling setState() triggers a <strong>rebuild</strong> of the widget, which re-executes the build() method and updates the UI based on the new state.</li></ul><pre>setState(() {<br>  counterValue++;<br>});</pre><ul><li><strong>Use case:</strong> Use this method whenever the widget’s state changes and you need the UI to reflect those changes.</li></ul><h4><strong>6. deactivate()</strong></h4><ul><li>The deactivate() method is called when the widget is <strong>temporarily</strong> removed from the widget tree, usually during a rebuild.</li><li>Unlike dispose(), which is called when the widget is permanently removed, deactivate() is for cleanup that needs to happen during temporary removals.</li></ul><pre>@override<br>void deactivate() {<br>  super.deactivate();<br>  // Clean up resources like unsubscribing from streams temporarily<br>  _myStreamSubscription?.pause();<br>}</pre><ul><li><strong>Use case:</strong> Cleanup tasks before the widget is removed or when its state is no longer needed.</li></ul><h4><strong>7. dispose()</strong></h4><ul><li>The dispose() method is called when the stateful widget is <strong>permanently</strong> removed from the widget tree.</li><li>This is the final cleanup method, where you should release any resources (like animation controllers, streams, or other subscriptions) to avoid <strong>memory leaks</strong>.</li></ul><pre>@override<br>void dispose() {<br>  _myAnimationController.dispose();<br>  super.dispose();<br>}</pre><ul><li><strong>Use case:</strong> Use this method to release resources and perform final cleanup when the widget is no longer in use.</li></ul><h4><strong>Conclusion</strong></h4><p>Understanding the lifecycle methods of stateful widgets is essential for managing state effectively and optimizing app performance in Flutter. By mastering methods like initState(), didChangeDependencies(), build(), setState(), and dispose(), you can create efficient, responsive, and well-managed widgets.</p><p>Remember to always use dispose() to clean up resources and setState() wisely to avoid unnecessary rebuilds. Properly handling the lifecycle methods will help you build high-quality, maintainable Flutter applications.</p><p>For any suggestions or corrections, feel free to reach out to me at <a href="http://suryajillellamudi.com/">suryajillellamudi.com</a>.</p><p>Thanks for reading! If you enjoyed this article, please give it a clap 👏 and follow me to get notified when I publish new content. Have a great day! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d27f1c4d0ff8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/understanding-the-lifecycle-methods-of-stateful-widgets-in-flutter-d27f1c4d0ff8">Understanding the Lifecycle Methods of Stateful Widgets in Flutter</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Transform Markdown into HTML Using JavaScript and npm]]></title>
            <link>https://medium.com/builtfordevs/how-to-transform-markdown-into-html-using-javascript-and-npm-4328a177570a?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4328a177570a</guid>
            <category><![CDATA[markdown-to-html]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[zero-md-usage]]></category>
            <category><![CDATA[markdown]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Wed, 27 Nov 2024 19:32:06 GMT</pubDate>
            <atom:updated>2025-08-29T07:17:30.468Z</atom:updated>
            <content:encoded><![CDATA[<p>Not a Member? <a href="https://javascript.plainenglish.io/how-to-transform-markdown-into-html-using-javascript-and-npm-4328a177570a?sk=adaa00ef24edb010901a4381aed32846">Click here</a></p><blockquote><strong>Suprise at the end</strong></blockquote><ul><li>There’s an even simpler way to render Markdown directly in your browser using just <strong>one line of code</strong>. Stick around to find out how!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RgSThvACWrGeyn2nssxE9Q.jpeg" /></figure><p>Markdown has become the go-to syntax for writing lightweight and easily readable formatted text. Whether documenting a project, writing a blog post, or creating content for a web application, Markdown offers simplicity and flexibility. However, when it comes to displaying this content on the web, you need to convert it into HTML — a format browsers understand.</p><p>In this article, we’ll explore how to transform Markdown into HTML using JavaScript and npm. We’ll leverage the power of the marked package, a fast and robust Markdown parser. By the end of this guide, you’ll be able to seamlessly convert Markdown content into HTML, whether you’re building a web application or automating content processing. Let’s dive in!</p><h4>Prerequisites</h4><p>Before we begin, make sure you have the following:</p><ol><li><strong>Node.js and npm installed</strong></li></ol><ul><li>Node.js allows you to run JavaScript outside a browser, and npm (Node Package Manager) is used to install packages like marked.</li><li>If you don’t have them installed, download them from <a href="https://nodejs.org/">nodejs.org</a> and follow the installation steps.</li></ul><p>2. <strong>A basic understanding of JavaScript</strong></p><ul><li>You should know how to write and run simple JavaScript code.</li></ul><p>3. <strong>A code editor</strong></p><ul><li>Any text editor will work, but something like <a href="https://code.visualstudio.com/">Visual Studio Code</a> makes writing and managing code easier.</li></ul><h4>Installing the marked package</h4><ul><li>Once you have created a folder, now we need to install marked package using npm .</li></ul><pre>npm init -y<br>npm install marked</pre><h4>Setting Up the Project</h4><ul><li>To start, let’s create a simple project that reads a Markdown file and converts it into HTML using JavaScript.</li></ul><p><strong>Step 1: Create a Sample Markdown File</strong></p><p>example.md</p><pre>###Markdown to HTML<br><br>- This is a markdown file example.<br><br>```javascript<br>function sum(int a, int b) {<br> return a + b;<br>}<br></pre><p><strong>Step 2: Script using Javascript</strong></p><p>render-markdown.js</p><pre>const fs = require(&#39;fs&#39;);<br>const { marked } = require(&#39;marked&#39;); // Use named import<br>const http = require(&#39;http&#39;);<br>const path = require(&#39;path&#39;);<br><br>// Path to your markdown file<br>const markdownFilePath = path.join(__dirname, &#39;example.md&#39;);<br><br>// Function to convert Markdown to HTML<br>function renderMarkdownToHtml(markdownFilePath) {<br>    const markdown = fs.readFileSync(markdownFilePath, &#39;utf8&#39;);<br>    return marked(markdown); // Call the `marked` function<br>}<br><br>// Create an HTTP server to serve the HTML<br>http.createServer((req, res) =&gt; {<br>    if (req.url === &#39;/&#39;) {<br>        const htmlContent = renderMarkdownToHtml(markdownFilePath);<br>        res.writeHead(200, { &#39;Content-Type&#39;: &#39;text/html&#39; });<br>        res.end(`<br>            &lt;!DOCTYPE html&gt;<br>            &lt;html lang=&quot;en&quot;&gt;<br>            &lt;head&gt;<br>                &lt;meta charset=&quot;UTF-8&quot;&gt;<br>                &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>                &lt;title&gt;Markdown Viewer&lt;/title&gt;<br>                &lt;style&gt;<br>                    body {<br>                        font-family: Arial, sans-serif;<br>                        margin: 20px;<br>                    }<br>                &lt;/style&gt;<br>            &lt;/head&gt;<br>            &lt;body&gt;<br>                &lt;div id=&quot;content&quot;&gt;${htmlContent}&lt;/div&gt;<br>            &lt;/body&gt;<br>            &lt;/html&gt;<br>        `);<br>    } else {<br>        res.writeHead(404, { &#39;Content-Type&#39;: &#39;text/plain&#39; });<br>        res.end(&#39;404 Not Found&#39;);<br>    }<br>}).listen(3000, () =&gt; {<br>    console.log(&#39;Server is listening on port 3000&#39;);<br>});</pre><p><strong>Step 3: Run the Script</strong></p><ol><li>Open your terminal and navigate to the folder containing example.md and render-markdown.js.</li><li>Run the following command to start the server:</li></ol><pre>node render-markdown.js</pre><ul><li>Open a browser and go to http://localhost:3000. You’ll see the content of. example.md rendered as HTML!</li></ul><p><strong>Note:</strong></p><ul><li>In this example, both example.md and render-markdown.js are in the same folder. If your files are organized differently, update the path in markdownFilePath accordingly.</li></ul><h4><strong>Surprise! Render Markdown with Just One Line</strong></h4><p>Here’s a simpler way to render Markdown files directly in your browser without writing a server script. With the <strong>zero-md</strong> web component, you can display a Markdown file with a single HTML tag!</p><pre>&lt;!DOCTYPE html&gt;  <br>&lt;html lang=&quot;en&quot;&gt;  <br>&lt;head&gt;  <br>    &lt;meta charset=&quot;UTF-8&quot;&gt;  <br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;  <br>    &lt;title&gt;Markdown Viewer with zero-md&lt;/title&gt;  <br>&lt;/head&gt;  <br>&lt;body&gt;  <br><br>    &lt;!-- Include the polyfill for web components --&gt;  <br>    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js&quot;&gt;&lt;/script&gt;  <br><br>    &lt;!-- Load zero-md module --&gt;  <br>    &lt;script type=&quot;module&quot; src=&quot;https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js&quot;&gt;&lt;/script&gt;  <br><br>    &lt;!-- Render the markdown file --&gt;  <br>    &lt;zero-md src=&quot;example.md&quot;&gt;&lt;/zero-md&gt;  <br><br>&lt;/body&gt;  <br>&lt;/html&gt;  </pre><p><strong>How It Works</strong></p><p>1. The &lt;zero-md&gt; tag fetches the specified Markdown file (example.md) and automatically converts it into HTML.</p><p>2. It’s perfect for static sites where you want to render Markdown quickly without running JavaScript or setting up a server.</p><blockquote>Conclusion</blockquote><p>Converting Markdown to HTML has always been challenging! Whether you’re building a robust server-side application with marked or taking advantage of the simplicity of &lt;zero-md&gt; for static rendering, you now have the tools to display Markdown beautifully on the web.</p><p>For dynamic and programmatic use, marked is a powerful choice. On the other hand, &lt;zero-md&gt; offers a seamless, no-code solution for quick rendering. Pick the method that best suits your project and bring your Markdown content to life with ease!</p><p>For any suggestions or corrections, feel free to reach out to me at <a href="https://suryajillellamudi.com/">suryajillellamudi.com</a>.</p><p>Thanks for reading! If you enjoyed this article, please give it a clap 👏 and follow me to get notified when I publish new content. Have a great day! 😊</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><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://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4328a177570a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/how-to-transform-markdown-into-html-using-javascript-and-npm-4328a177570a">How to Transform Markdown into HTML Using JavaScript and npm</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Twice-a-Day Workouts to a Month of Rest: How My Body and Mind Responded]]></title>
            <link>https://medium.com/health-science/from-twice-a-day-workouts-to-a-month-of-rest-how-my-body-and-mind-responded-d6465a61023c?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6465a61023c</guid>
            <category><![CDATA[wellness]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[health]]></category>
            <category><![CDATA[fitness]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Tue, 05 Nov 2024 13:39:14 GMT</pubDate>
            <atom:updated>2024-11-29T02:54:24.654Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Person Holding Barbell Rod" src="https://cdn-images-1.medium.com/max/1024/1*T1uTKFpggiVjeXPResqD8Q.jpeg" /><figcaption>source: AI Generated</figcaption></figure><p>Recently, my workout routine took an unexpected turn, giving me a clear idea of how our bodies react to long breaks. For the last 5 months, I have been following a structured Push-Pull-Legs (PPL) split, working out twice a day — doing cardio in the morning and strength training in the evening — six days a week. I kept a disciplined diet, allowing myself a cheat day once or twice a month to stay balanced and avoid burnout.</p><p>By mid-September, I could see the changes in my body: better muscle definition, increased muscle mass, and noticeable improvements in my strength and stamina. It felt great to see all the effort paying off. But then something unexpected came up, and I had to visit my hometown to take care of some important work.</p><h4><strong>A Month Without the Gym</strong></h4><p>In my hometown, a rural village, I had no access to gym facilities or even basic workout equipment. What I thought would be a <strong>short trip of a week or 10 days</strong> gradually extended to a full month. I couldn’t maintain my diet or continue my regular exercise regimen during this time. <strong>No cardio, no lifting, no clean eating.</strong></p><h4><strong>Returning to the Gym: The Physical and Mental Toll</strong></h4><p>When I returned to my workplace after this month-long hiatus, I was curious (and somewhat anxious) to see how my body had transformed in the absence of training. The changes were noticeable and <strong>disheartening</strong>:</p><ol><li><strong>Muscle Mass and Strength</strong>: Visually, I felt like I had lost about half of the muscle gains I had built over the past 5 months. While this might not be entirely accurate in terms of muscle loss, the loss of muscle tone and tightness was evident. This is likely due to muscle atrophy, which can occur when muscles are not consistently stimulated.</li><li><strong>Energy Levels and Endurance</strong>: Mentally, I felt lethargic, almost like I was back to being my old, less active self. In the gym, this mental fatigue translated to an inability to push myself beyond basic warm-up sets. I struggled to last even <strong>half an hour</strong> before feeling completely drained.</li><li><strong>Muscle Recovery</strong>: What surprised me the most was how sore my muscles were after each workout. It seemed like my <strong>muscle recovery capability</strong> had diminished, a common phenomenon due to the body’s temporary deconditioning after a long period of inactivity.</li></ol><h4><strong>Gradual Return to Routine</strong></h4><p>Realizing that pushing too hard too soon would do more harm than good, I adjusted my workout schedule to a more manageable <strong>one session per day</strong> for the first week. This allowed my body to readjust and gradually restore its former capacity.</p><p>After that first week, I went back to my twice-a-day routine, doing cardio in the morning and strength training in the evening. Within just three days, I noticed my muscles starting to regain their shape and size. This quick recovery is thanks to <strong>muscle memory</strong>, where your muscles “remember” their previous state and adapt faster after a break.</p><h4>Conclusion</h4><p><strong>Taking a break from the gym does not mean losing all your hard-earned progress.</strong> While there was a temporary decline in muscle tone and strength, my experience demonstrated that with the right comeback strategy and consistent effort, it is entirely possible to regain what you have worked for.</p><p>This break taught me the significance of both <strong>physical resilience</strong> and <strong>mental strength</strong>. Despite setbacks, the human body has an incredible capacity to bounce back, aided by the phenomenon of muscle memory. By maintaining discipline and gradually increasing intensity, I was able to restore my fitness levels and continue progressing.</p><p>So, if you find yourself needing to take a break from the gym due to unforeseen circumstances, don’t be too hard on yourself. <strong>Trust in your body’s ability to recover</strong> and remember that consistency in the long term outweighs short-term interruptions.</p><p>Thanks For Reading! Have a great day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6465a61023c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/health-science/from-twice-a-day-workouts-to-a-month-of-rest-how-my-body-and-mind-responded-d6465a61023c">From Twice-a-Day Workouts to a Month of Rest: How My Body and Mind Responded</a> was originally published in <a href="https://medium.com/health-science">Health and  Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[About Me — Surya]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/about-me-stories/about-me-surya-be71ad5abb38?source=rss-4f193276089f------2"><img src="https://cdn-images-1.medium.com/max/1440/1*DEHVvUpNZghXnEiAcQDC7w.jpeg" width="1440"></a></p><p class="medium-feed-snippet">Software Engineer</p><p class="medium-feed-link"><a href="https://medium.com/about-me-stories/about-me-surya-be71ad5abb38?source=rss-4f193276089f------2">Continue reading on About Me Stories »</a></p></div>]]></description>
            <link>https://medium.com/about-me-stories/about-me-surya-be71ad5abb38?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/be71ad5abb38</guid>
            <category><![CDATA[surya]]></category>
            <category><![CDATA[myself]]></category>
            <category><![CDATA[about-me]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[about-me-stories]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Tue, 22 Oct 2024 19:26:11 GMT</pubDate>
            <atom:updated>2024-10-22T19:26:11.859Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Why Every Developer Should Be Using GitHub CLI Right Now!]]></title>
            <link>https://medium.com/builtfordevs/why-every-developer-should-be-using-github-cli-right-now-d470bd343d13?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d470bd343d13</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[github-cli]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 06:25:25 GMT</pubDate>
            <atom:updated>2025-08-29T07:18:20.343Z</atom:updated>
            <content:encoded><![CDATA[<p>Still not using GitHub CLI? Then you’re a step behind the top. Don’t tell me you’re missing out on this game-changing tool!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tX3qTfdbzqAjR5XUuUgk7w.jpeg" /></figure><h4><strong>How GitHub CLI Makes My Life Easier</strong></h4><p>These days, I use GitHub CLI almost every day. Before I started using it, my workflow was much slower. After finishing my code, I would have to open the GitHub website, create a pull request, and then go through the process of merging it manually.</p><p>Imagine you’re building a new project for yourself. Once you complete the first version, you need to head over to GitHub, create a new repository, and then link that repo to your project before pushing the code. It’s a lot of back-and-forth between your code editor and the browser.</p><p>But now, with GitHub CLI, everything is much simpler. I can create a repository directly from the terminal, create pull requests, automatically merge them, or even just view the pull request details — all without ever leaving my terminal. GitHub CLI makes it possible to handle everything with a few simple commands, which saves a lot of time and keeps me focused on writing code.</p><p>Now, let’s dive into GitHub CLI!”</p><h4><strong>What is GitHub CLI?</strong></h4><p>GitHub CLI (Command Line Interface) is a tool that allows you to interact with GitHub directly from your terminal. Instead of switching back and forth between your code editor and the GitHub website, you can use GitHub CLI to manage your repositories, issues, pull requests, and more — all with simple commands. It’s designed to make your workflow faster and more efficient by bringing the power of GitHub into your terminal. Whether you’re a beginner or an experienced developer, GitHub CLI helps you stay focused on your code without the distractions of the web interface.</p><h4><strong>What Can We Do with GitHub CLI?</strong></h4><p>GitHub CLI gives you access to many GitHub features right from your terminal, making your workflow faster and more convenient. Here’s a quick look at what you can do with GitHub CLI:</p><ul><li><strong>Manage Repositories</strong>: You can view, create, clone, and fork repositories without opening the GitHub website.</li><li><strong>Handle Issues and Pull Requests</strong>: Easily create, close, edit, and view issues and pull requests. You can even review, compare (diff), and merge pull requests directly from your terminal.</li><li><strong>Automate Workflows</strong>: Run, view, and list GitHub Actions workflows to keep track of your automation processes.</li><li><strong>Manage Releases</strong>: Create, list, view, and delete releases to share your project’s new versions.</li><li><strong>Work with Gists</strong>: Quickly create, edit, list, view, and delete gists to share code snippets with others.</li><li><strong>Use Codespaces</strong>: List, create, delete, and connect to GitHub Codespaces for a cloud-based development environment.</li><li><strong>Access the GitHub API</strong>: Retrieve information from the GitHub API to get data or perform advanced tasks directly from the terminal.</li></ul><p>With GitHub CLI, you can do all these tasks using simple commands, making it a powerful tool to boost your productivity as a developer.</p><p><strong>Essential GitHub CLI Commands</strong></p><p>Here are some of the most useful GitHub CLI commands to get you started:</p><p><strong>Authentication</strong></p><ul><li>gh auth login: Logs you into your GitHub account from the terminal.</li><li>gh auth logout: Logs you out of your GitHub account.</li></ul><p><strong>Working with Repositories</strong></p><ul><li>gh repo create: Creates a new repository on GitHub.</li><li>gh repo clone &lt;repository-name&gt;: Clones a GitHub repository to your local machine.</li></ul><p><strong>Handling Pull Requests</strong></p><ul><li>gh pr create: Creates a new pull request for your code changes.</li><li>gh pr merge &lt;pr-number&gt;: Merges a pull request.</li></ul><p>These are just a few of the powerful commands available in GitHub CLI. To explore more commands and learn how to use them in your projects, check out the <a href="https://cli.github.com/manual/">official GitHub CLI documentation</a>.</p><h4><strong>Installation</strong></h4><p>To get started with GitHub CLI, you’ll need to install it on your system. Follow the installation guide on the <a href="https://github.com/cli/cli#installation">GitHub CLI installation page</a> to set it up on your machine.</p><h4><strong>Conclusion</strong></h4><p>As a developer who uses GitHub CLI daily, I can confidently say it has transformed my workflow. It makes managing repositories, pull requests, and issues much simpler and faster. If you haven’t tried GitHub CLI yet, I highly recommend giving it a shot. You’ll likely find it just as beneficial, making your development process smoother and more efficient. Let’s start using this great tool and make our coding easier!</p><p>For any suggestions or corrections, feel free to reach out to me a <a href="https://suryajillellamudi.com/">suryajillellamudi.com</a></p><p>Thanks for reading! If you enjoyed this article, please give it a clap 👏 and follow me to get notified when I publish new content. Have a great day!</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=d470bd343d13" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/why-every-developer-should-be-using-github-cli-right-now-d470bd343d13">Why Every Developer Should Be Using GitHub CLI Right Now!</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two Years as a Flutter Developer: Insights and Experiences (Part 1)]]></title>
            <link>https://medium.com/builtfordevs/two-years-as-a-flutter-developer-insights-and-experiences-part-1-5f5cda9618cc?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f5cda9618cc</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Sat, 12 Oct 2024 01:44:10 GMT</pubDate>
            <atom:updated>2025-08-29T07:18:38.358Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I’ve completed two years as a full-time Flutter developer. During this time, I’ve learned a lot, faced some challenges, and gained valuable experience. I want to share some of the key things I’ve learned, hoping they might help other developers (or at least someone like me!).</p><figure><img alt="A man walking on bars" src="https://cdn-images-1.medium.com/max/720/1*_INJc2-9hI_89-En9IHmdA.png" /><figcaption>source: Google</figcaption></figure><ol><li><a href="#8a47">Handling State Management Effectively</a></li><li><a href="#840a">Using an App Event Bus</a></li><li><a href="#1a6a">Stateless vs Stateful Widgets</a></li><li><a href="#753a">Problems with setState</a></li><li><a href="#5189">Getting Familiar with Native Code</a></li><li><a href="#1e3a">Maintaining a High Crash-Free Rate (99.1%+) and Crash-Free Sessions (99.7%+)</a></li><li><a href="#83b6">Importance of Flutter Documentation</a></li><li><a href="#acd7">Why Creating Our Own Library Can Be Beneficial</a></li><li><a href="#4a1a">The Importance of Staying Updated with Flutter</a></li></ol><h4>Handling State Management Effectively</h4><ul><li>Using State Management is essential for keeping our app’s data in sync with the UI. As your app grows, managing the state directly with widgets like setState can get messy and lead to bugs or performance issues.</li><li>Using state management makes your code more organized and easier to debug.</li></ul><p><strong>Is There a Best State Management Library?</strong></p><ul><li>No, there isn’t a single <strong>best</strong> state management library. It all depends on your app’s needs.</li><li>here are many state management solutions like Bloc/Cubit, Riverpod, Provider, and more. The key is to choose the one that best fits your app’s use case. Always go through the documentation of the libraries first to decide which library suits your app.</li></ul><p><strong>What Do We Use in Our App?</strong></p><ul><li>We use <strong>Jetpack</strong>, an open-source library developed by one of our team members.</li><li>Jetpack includes tools like ViewModel and EventQueue, which help us manage state effectively.</li><li>You can checkout <strong>jetpack</strong> <a href="https://pub.dev/packages/jetpack">here</a>.</li></ul><h4>Using an App Event Bus</h4><ul><li>We can create an App Event Bus using flutter streams.</li></ul><p><strong>What is a Stream?</strong></p><p>A stream in Flutter is a sequence of asynchronous data that you can listen to, like a flow of events. It delivers data over time, which means you can react to updates as they happen.</p><p><strong>Importance of Streams</strong></p><p>Streams are essential for handling real-time data in Flutter apps. They allow your app to react instantly to changes, making the user experience smoother and more interactive. They’re great for tasks like updating UI, handling user input, or managing data from APIs.</p><p>Please go through the streams documentation <a href="https://dart.dev/libraries/async/using-streams">here</a>. Now let’s get back to app event bus.</p><p><strong>Why do we need app event bus?</strong></p><ul><li>The app event bus allows us to listen for changes from other screens in our app easily.</li><li>For example, consider a scenario where we show a user’s feed based on their selected interests. If the user changes their interests on a different screen, we can fire a FeedInvalidated event.</li><li>On the MyFeed page, we would be listening to the app event stream. When the FeedInvalidated event is triggered, we simply <strong>refresh</strong> the feed.</li></ul><p><strong>Note:</strong></p><p>Avoid using the app event bus unnecessarily. It should be used primarily for communicating between different screens when needed.</p><p>Here is basic example of how to create AppEventBus .</p><pre>@singleton<br>class AppEventBus {<br>  // Create a StreamController that allows broadcasting events to multiple listeners<br>  final StreamController&lt;AppEvent&gt; _appEventsStreamController =<br>      StreamController.broadcast();<br><br>  // Expose the stream for external listeners<br>  Stream&lt;AppEvent&gt; get stream =&gt; _appEventsStreamController.stream;<br><br>  // Method to fire an event<br>  void fire(AppEvent event) {<br>    _appEventsStreamController.add(event);<br>  }<br>}<br><br>// Base class for app events<br>sealed class AppEvent {}<br><br>// Example event for feed invalidation<br>class FeedInvalidatedEvent extends AppEvent {}</pre><ul><li>The singleton pattern ensures that a class has only one instance throughout the application and provides a global point of access to it.</li></ul><h4>Stateless vs Stateful Widgets</h4><p><strong>Stateless Widgets</strong></p><p>Stateless widgets are immutable and do not maintain any internal state. Once they are built, their properties cannot change, and they depend solely on the data passed to them.</p><p><strong>Stateful Widgets</strong></p><p>Stateful widgets are mutable and can change their internal state. They maintain a separate state object that holds data that can change during the widget’s lifecycle.</p><p><strong>Which to Use?</strong></p><ul><li>Make sure you need to use stateless widgets wherever possible with the help of state management.</li><li>UI widgets should be dumb , they should simply re-render when the state they are listening to changes. This approach keeps your code cleaner, more organized, and easier to understand.</li><li>Stateless widgets also help improve your app’s performance since they are lightweight and don’t need to manage state changes.</li><li>If you find that stateless widgets won’t fit your use case, then go ahead with stateful widgets. Use them sparingly to avoid complexity and potential performance issues.</li></ul><h4>Problems with setState</h4><p>Using setState in Flutter is straightforward for managing state in simple cases, but as your app grows, it can lead to a few issues:</p><ul><li><strong>Messy Code:</strong> When your widget tree becomes more complex, relying heavily on setState can make your code harder to read and maintain. It can spread state logic all over your widget, making the code less organized.</li><li><strong>Performance Issues:</strong> setState triggers a full rebuild of the widget and its descendants. This can be inefficient, especially if only a small part of the UI needs to be updated, leading to unnecessary rendering.</li><li><strong>Mount Check Issue:</strong> If a user interacts with the screen and performs an action that uses setState, and then navigates back before that setState action completes, it can cause a mount check error. This happens because setState tries to update a widget that no longer exists in the widget tree, leading to an error since the screen is not rendered anymore.</li><li><strong>Lack of Scalability:</strong> setState is not ideal for managing state in large-scale apps. As your app grows, handling state with setState alone becomes unmanageable and prone to bugs.</li></ul><p>My suggestion is to <strong>avoid using </strong>setState<strong> as much as possible</strong> and instead use state management solutions. Even if you’re only updating a single variable on the screen, it’s better to use state management. The problem with using setState is that once you start with it, you’ll be tempted to use it again for another variable, which leads to messy and complicated code in the long run.</p><p>If you do choose to use setState, make sure to always check if the widget is still mounted before making any updates to prevent mount check errors.</p><h4><strong>Getting Familiar with Native Code</strong></h4><p>It’s a good idea to get familiar with native code when working with Flutter. Even though Flutter lets you create apps with one codebase, sometimes you’ll need to connect directly with the platform-specific features of iOS and Android.</p><p>For example, you might have to write your own method channels to talk to the native code on both platforms. This helps you use device-specific features that Flutter might not handle on its own.</p><p>Knowing some native code can make your app more powerful by letting you use features from iOS and Android that aren’t always available in Flutter.</p><h4>Maintaining a High Crash-Free Rate (99.1%+) and Crash-Free Sessions (99.7%+)</h4><p><strong>User: </strong>A user is an individual installation of your app on a device. If a person has your app on multiple devices, each installation counts as a unique user.</p><p><strong>Session:</strong> A session is a continuous period when a user interacts with your app. A new session starts when the app is cold-started or resumed after being in the background for at least 30 minutes.</p><p><strong>Crash-Free Users: </strong>The crash-free users metric indicates the percentage of users who engaged with your app during a selected time period without encountering any crashes. It reflects the overall user experience.</p><p><strong>Crash-Free Sessions: </strong>The crash-free sessions metric measures the percentage of sessions that occurred without crashes during a specific time frame. It indicates the reliability of your app.</p><p>For more information on crash-free metrics, click <a href="https://firebase.google.com/docs/crashlytics/crash-free-metrics">here</a>.</p><p>To make sure our app runs smoothly, we need to aim for a crash-free rate of 99.1% or higher and crash-free sessions of 99.7% or more.</p><p><strong>What Do We Do to Improve Crash-Free Rate?</strong></p><p>We use Firebase for Crashlytics, which helps us monitor app stability effectively. After every release, we check Crashlytics daily. If we find any fatal errors, we prioritize fixing them and quickly release a patch version. If the issues are minor — meaning they affect only a few users or result in just a few crashes — we’ll address those in the next planned release.</p><p>By consistently following this process, we gradually improve our app’s crash-free rate, ensuring a better experience for our users.</p><h4>Importance of Flutter Documentation</h4><ul><li>It’s really important to go through the Flutter documentation thoroughly when you’re building apps. The documentation is straightforward and clearly explains every property and feature you might need.</li><li>I recommend that when you run into issues or want to check if something exists in a widget, take the time to read the Flutter documentation first. Before jumping onto Google or asking ChatGPT, try the official docs. This way, you’ll not only find the answers you’re looking for but also learn about all the properties of the widget.</li><li>Understanding the documentation helps you become more familiar with Flutter and improves your coding skills over time. There are many widgets that you might not even know exist, and discovering them in the documentation can make your work much easier.</li><li>Knowing the ins and outs of the widgets will give you more tools for future projects and make your development process smoother. So, always make the Flutter documentation your first stop!</li></ul><p>Here’s the link to the <a href="https://docs.flutter.dev/">flutter documentation</a>.</p><h4><strong>Why Creating Our Own Library Can Be Beneficial</strong></h4><p><strong>Dependency Issues</strong></p><p>Relying on third-party libraries can create significant problems when upgrading your Flutter and Dart versions. If the library’s developers haven’t updated their code to be compatible with the latest versions, it can lead to errors and conflicts in your project. This can slow down your development process and prevent you from using the latest Flutter features by not being able to upgrade Flutter.</p><p><strong>Control</strong></p><p>When a library is crucial for your project, it’s worth considering creating your own version tailored to your specific needs. By developing your own library, you have complete control over its features and updates. This way, you won’t be reliant on other developers to make changes or keep it up to date, ensuring that it always meets your project’s requirements.</p><p><strong>Use Well-Maintained Libraries</strong></p><p>It’s perfectly fine to use third-party libraries, but make sure they are actively maintained. Libraries that receive regular updates are more likely to be compatible with the latest versions of Flutter and Dart. Avoid using libraries that are no longer maintained, as they can introduce risks to your project, leading to bugs and performance issues.</p><p><strong>Simpler Alternatives</strong></p><p>If your use case can be effectively addressed using Flutter’s built-in features, it’s often better to add the necessary code directly to your project instead of relying on external packages. Many third-party packages consist solely of Dart code, which means you can easily replicate their functionality within your project. This approach can simplify your project and reduce dependencies, making it easier to maintain in the long run.</p><h4>The Importance of Staying Updated with Flutter</h4><p>In one of the Flutter versions, I faced a frustrating issue with the Impeller rendering. The shader mask for text worked perfectly on Android devices but not on iOS, which affected my app’s appearance. Thankfully, I learned that this issue was resolved in an upcoming Flutter version. By keeping my Flutter SDK up to date, I was able to benefit from this fix, ensuring a smoother experience for both myself and my users.</p><p>Here are some steps that we need to follow to stay updated with Flutter:</p><ul><li><strong>Follow the Official Flutter Blog</strong>: The Flutter team frequently posts about updates, new features, and best practices on their official blog. Subscribing helps us stay informed about important changes.</li><li><strong>Join the Flutter Community</strong>: Engaging with the Flutter community through forums and social media allows us to gain insights, tips, and the latest news from other developers.</li><li><strong>Regularly Check Flutter Documentation</strong>: The official documentation is always updated, so it’s a good habit to review it often. This helps us understand new features and best practices.</li></ul><p>Staying updated has not only helped me overcome issues like the Impeller problem but has also improved my overall development skills and project quality. Flutter is gradually introducing many changes and adding new widgets and features that enhance the overall quality of our apps. By staying updated with Flutter, we’ll be aware of these improvements and can use them in our projects.</p><h4><strong>Conclusion</strong></h4><p>That’s enough for now, this has already become a long article! I’ll come back with Part 2 soon, sharing more insights and tips based on my journey as a Flutter developer.</p><p>For any suggestions or corrections, feel free to reach out to me a <a href="https://suryajillellamudi.com/">suryajillellamudi.com</a></p><p>Thanks for reading! If you enjoyed this article, please give it a clap 👏 and follow me to get notified when I publish new content. Have a great day!</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=5f5cda9618cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/two-years-as-a-flutter-developer-insights-and-experiences-part-1-5f5cda9618cc">Two Years as a Flutter Developer: Insights and Experiences (Part 1)</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Animated Widgets in Flutter]]></title>
            <link>https://medium.com/builtfordevs/animated-widgets-in-flutter-6bb73a4415e6?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6bb73a4415e6</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Sat, 31 Aug 2024 09:09:38 GMT</pubDate>
            <atom:updated>2025-08-29T07:16:27.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Flutter Animations Image [credits: google images]" src="https://cdn-images-1.medium.com/max/1024/1*WwH3GYJVWUPaGjDaiaTpJQ.jpeg" /></figure><p>In Flutter, animated widgets make it easy to add smooth animations to your app. They help you create dynamic effects with simple code.</p><p>In this article, we’ll look at some of the most commonly used animated widgets. Whether you want to animate positions, sizes, or other changes, these widgets will help you do it easily.</p><h4>List Of Widget that mentioned in this Article</h4><ol><li><a href="#bb17">Animated Positioned</a></li><li><a href="#3c18">Animated Scale</a></li><li><a href="#7688">Animated Align</a></li><li><a href="#de7e">Animated Container</a></li><li><a href="#ed0c">Animated Opacity</a></li><li><a href="#438a">Animated Size</a></li><li><a href="#8346">Animated Switcher</a></li><li><a href="#8eba">Animated List</a></li></ol><h4>Animated Positioned</h4><ul><li>The <strong>AnimatedPositioned</strong> widget in Flutter is like a regular Positioned widget, but with a cool twist — it smoothly animates changes in position over time.</li><li>This widget only works, when it is a child of Stack.</li><li><strong>Positioned Widget</strong>: Normally, you use the Positioned widget inside a Stack to place a widget at a specific location (using top, bottom, left, or right).</li><li>This AnimatedPositioned Widget does the same thing but adds animation when the position changes. For example, if you change the top value, the widget will slide to the new position instead of jumping instantly.</li></ul><pre>AnimatedPositioned(<br>      duration: const Duration(milliseconds: 300),<br>      top: hideAppbar ? -kToolbarHeight : 0,<br>      left: 0,<br>      right: 0,<br>      child: Container(<br>        height: kToolbarHeight,<br>        color: Colors.white,<br>        child: const Text(<br>          &#39;Animated Positioned AppBar&#39;,<br>          textAlign: TextAlign.center,<br>          style: TextStyle(<br>            color: Colors.black,<br>            fontSize: 20,<br>            fontWeight: FontWeight.bold,<br>          ),<br>        ),<br>      ),<br>    );</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*f8sC5F6awiOx7i7JUY6rpg.gif" /></figure><h4>Animated Scale</h4><ul><li>The <strong>AnimatedScale</strong> widget in Flutter is like a magnifying glass for your widgets — it smoothly animates changes in the scale of a widget, making it bigger or smaller.</li><li><strong>Scale Widget</strong>: Normally, to scale a widget, you’d use a <strong>Transform.scale</strong> widget. However, that change would be instant. The AnimatedScale widget does the same thing but with a smooth animation when the scale factor changes.</li><li>The <strong>scale</strong> parameter defines the size of the widget relative to its original size, where 1.0 is the original size and values greater than 1.0 scale up the widget.</li></ul><pre>Column(<br>        crossAxisAlignment: CrossAxisAlignment.center,<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: [<br>          AnimatedScale(<br>            scale: scaleImage ? 2.0 : 1.0,<br>            duration: const Duration(milliseconds: 500),<br>            child: Image.network(<br>              &quot;https://onlyflutter.com/wp-content/uploads/2024/03/flutter_banner_onlyflutter.png&quot;,<br>              width: 200,<br>              height: 200,<br>            )<br>          ),<br>          const SizedBox(height: 16),<br>          ElevatedButton(<br>            onPressed: () {<br>              setState(() {<br>                scaleImage = !scaleImage;<br>              });<br>            },<br>            child: const Text(&#39;Scale Image&#39;),<br>          ),<br>        ],<br>     );</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*QQRrn-jLga9_aLxC1rnZVw.gif" /></figure><h4>Animated Align</h4><ul><li>The <strong>AnimatedAlign</strong> widget in Flutter animates changes in the alignment of a child widget within its parent. This widget smoothly transitions the child’s position from one alignment to another over time.</li><li><strong>Alignment</strong>: Normally, you use the Align widget to position a child within its parent based on an alignment value (e.g., top-left, center). The AnimatedAlign widget adds animation to this transition, making the movement between alignments smooth and visually appealing.</li></ul><pre>Column(<br>        crossAxisAlignment: CrossAxisAlignment.center,<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: [<br>          AnimatedAlign(<br>            alignment: isAligned ? Alignment.bottomRight : Alignment.topLeft,<br>            duration: const Duration(milliseconds: 500),<br>            child: Container(<br>              width: 100,<br>              height: 100,<br>              color: Colors.black,<br>              child: const Center(<br>                child: Text(<br>                  &#39;Animated Align&#39;,<br>                  textAlign: TextAlign.center,<br>                  style: TextStyle(<br>                    color: Colors.white,<br>                    fontSize: 16,<br>                  ),<br>                ),<br>              ),<br>            ),<br>          ),<br>          ElevatedButton(<br>            onPressed: () {<br>              setState(() {<br>                isAligned = !isAligned;<br>              });<br>            },<br>            child: const Text(&#39;Toggle Align&#39;),<br>          ),<br>        ],<br>    );</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*wWiowGl0h9wmralv8YXxnA.gif" /></figure><h4>Animated Container</h4><ul><li>The <strong>AnimatedContainer</strong> widget in Flutter lets you smoothly animate changes to things like size, color, and padding. It makes your UI more dynamic by transitioning between different states smoothly.</li><li><strong>Container</strong>: Normally, you use a Container to create a box with properties like width, height, color, and padding. AnimatedContainer does the same but adds smooth animations when these properties change.</li></ul><pre>AnimatedContainer(<br>            duration: const Duration(milliseconds: 300),<br>            width: isExpanded ? 200.0 : 100.0,<br>            height: isExpanded ? 200.0 : 100.0,<br>            color: isExpanded ? Colors.black : Colors.red,<br>            padding: isExpanded<br>                ? const EdgeInsets.all(20.0)<br>                : const EdgeInsets.all(10.0),<br>            child: const Center(<br>              child: Text(<br>                &#39;Animated Container&#39;,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontSize: 16,<br>                ),<br>              ),<br>            ),<br>          ),</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*08XhLNqmT1iv0K0YUYVzig.gif" /></figure><h4>Animated Opacity</h4><ul><li>The <strong>AnimatedOpacity</strong> widget in Flutter animates changes to a widget’s transparency. It allows you to smoothly fade a widget in or out, making it more dynamic and engaging.</li><li><strong>Opacity</strong>: Usually, you use the Opacity widget to make a widget more or less transparent. AnimatedOpacity extends this by animating the fade effect over a set duration.</li></ul><pre>SizedBox(<br>            height: 100,<br>            child: ListView.separated(<br>              shrinkWrap: true,<br>              scrollDirection: Axis.horizontal,<br>              itemCount: _images.length,<br>              itemBuilder: (context, index) {<br>                return AnimatedOpacity(<br>                  duration: const Duration(milliseconds: 500),<br>                  opacity: _selectedImageIndex == index ? 1 : 0.3,<br>                  child: InkWell(<br>                    onTap: () {<br>                      setState(() {<br>                        _selectedImageIndex = index;<br>                      });<br>                    },<br>                    child: Image.network(<br>                      _images[index],<br>                      height: 100,<br>                      width: 100,<br>                    ),<br>                  ),<br>                );<br>              },<br>              separatorBuilder: (context, index) {<br>                return const SizedBox(width: 16);<br>              },<br>            ),<br>         );</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*RrO79ByORkA25HWznvt74A.gif" /></figure><h4>Animated Size</h4><ul><li>The <strong>AnimatedSize</strong> widget in Flutter animates changes in a widget’s size. It smoothly transitions the widget’s dimensions, making your UI more fluid and interactive.</li></ul><pre>Column(<br>        crossAxisAlignment: CrossAxisAlignment.center,<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: [<br>          ColoredBox(<br>            color: Colors.black,<br>            child: AnimatedSize(<br>              duration: const Duration(seconds: 1),<br>              curve: Curves.easeIn,<br>              child: SizedBox.square(<br>                dimension: _changeBoxSize ? 200.0 : 100.0,<br>                child: const Center(<br>                  child: Text(<br>                    &quot;Animated Box&quot;,<br>                    style: TextStyle(color: Colors.white),<br>                  ),<br>                ),<br>              ),<br>            ),<br>          ),<br>          ElevatedButton(<br>            onPressed: () {<br>              setState(() {<br>                _changeBoxSize = !_changeBoxSize;<br>              });<br>            },<br>            child: const Text(&quot;Toggle Box Size&quot;),<br>          ),<br>        ],<br>      )</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*UnrPIEnY0K7FmP_HwzRmEw.gif" /></figure><h4>Animated Switcher</h4><ul><li>The <strong>AnimatedSwitcher</strong> widget in Flutter provides a smooth transition between two widgets when their child changes. It automatically animates the replacement of the old widget with the new one, making your UI transitions smooth.</li></ul><pre>Column(<br>        crossAxisAlignment: CrossAxisAlignment.center,<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: [<br>          AnimatedSwitcher(<br>            duration: const Duration(milliseconds: 500),<br>            child: Image.network(<br>              _images[_selectedImageIndex],<br>              key: ValueKey&lt;int&gt;(_selectedImageIndex),<br>              height: 200,<br>              width: 200,<br>              fit: BoxFit.fill,<br>            ),<br>          ),<br>          ElevatedButton(<br>            onPressed: () {<br>              setState(() {<br>                _selectedImageIndex =<br>                    (_selectedImageIndex + 1) % _images.length;<br>              });<br>            },<br>            child: const Text(&quot;Switch Image&quot;),<br>          ),<br>        ],<br>     );</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*jsEq-2b0wzHZTenG9wzvxg.gif" /></figure><h4>Animated List</h4><ul><li>The <strong>AnimatedList</strong> widget in Flutter allows you to create lists with smooth animations when items are added or removed. It animates changes in the list, making your UI more dynamic and visually appealing.</li></ul><pre>Scaffold(<br>        body: AnimatedList(<br>          key: _listKey,<br>          initialItemCount: _items.length,<br>          itemBuilder: (context, index, animation) {<br>            return SizeTransition(<br>              sizeFactor: animation,<br>              child: ListTile(<br>                title: Text(_items[index]),<br>                trailing: IconButton(<br>                  icon: const Icon(Icons.delete),<br>                  onPressed: () =&gt; _removeItem(index),<br>                ),<br>              ),<br>            );<br>          },<br>        ),<br>        floatingActionButton: FloatingActionButton(<br>          onPressed: _addItem,<br>          child: const Icon(Icons.add),<br>        ));</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*C-4pEaEetBi5jYSIyZUqCg.gif" /></figure><h4>Conclusion</h4><p>There are many more animated widgets available in Flutter to help you create even more impressive animations. For more animations check out <a href="https://docs.flutter.dev/ui/widgets/animation">Flutter Animations</a>.</p><p>That’s all for today. Thanks for reading! If you enjoyed this article, please give it a clap.</p><p>For any questions or issues, feel free to reach out to me on <a href="https://www.linkedin.com/in/suryajillellamudi/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bb73a4415e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/animated-widgets-in-flutter-6bb73a4415e6">Animated Widgets in Flutter</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Dynamic App Icons in Flutter: A Step-by-Step Guide]]></title>
            <link>https://medium.com/builtfordevs/implementing-dynamic-app-icons-in-flutter-a-step-by-step-guide-530551b2db93?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/530551b2db93</guid>
            <category><![CDATA[premium]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Mon, 22 Jul 2024 16:27:39 GMT</pubDate>
            <atom:updated>2025-08-29T07:17:11.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TI40ZeRccqavcxI01tLCGg.jpeg" /></figure><p>Not a Member? <a href="https://medium.com/nerd-for-tech/implementing-dynamic-app-icons-in-flutter-a-step-by-step-guide-530551b2db93?sk=06723b333e6a629f87f0b3bbf361ab14">Click here</a></p><p>Nowadays, almost every application includes premium features, providing additional benefits for users. For premium users, it’s a great idea to change the app icon, as many apps like Zomato, Swiggy etc.</p><p>However, changing the app icon dynamically requires some effort. For Android or iOS applications, we simply update the respective native files. But for cross-platform frameworks like Flutter, we need to work on both Android and iOS to reflect the changes.</p><p>Now, let’s discuss a step-by-step guide to adding dynamic icons in Flutter.</p><h3>Android</h3><h4>Step 1:</h4><ul><li>For now, I would like to add an icon for a Premium User</li><li>First, we need to add new <a href="https://developer.android.com/guide/topics/manifest/activity-alias-element">activity-alias</a> for the Premium activity to display the new app icon for premium user.</li><li>We need to add new icons set for the premium app icon in your folder android-&gt;app-&gt;src-&gt;main-&gt;res</li><li>You can also add a separate round icon if required.</li></ul><pre>&lt;activity-alias android:name=&quot;.PremiumActivity&quot;<br>         android:enabled=&quot;false&quot;<br>         android:exported=&quot;true&quot;<br>         android:icon=&quot;@mipmap/ic_launcher_premium&quot;<br>         android:roundIcon=&quot;@mipmap/ic_launcher_premium_round&quot;<br>         android:targetActivity=&quot;.MainActivity&quot;&gt;<br>  &lt;intent-filter&gt;<br>   &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;<br><br>   &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;<br>  &lt;/intent-filter&gt;<br>&lt;/activity-alias&gt;</pre><h4>Note:</h4><p>Add all your app deeplinks inside the activity alias, just as you have them inside the main activity, to ensure that deeplinks work correctly.</p><h4>Step 2:</h4><p>Now, let’s create the plugin to change the icon</p><pre>class PremiumIconPlugin(private val context: Context) {<br>   private lateinit var channel: MethodChannel<br>   private val packageName = context.packageName<br><br>   fun initWith(binaryMessenger: BinaryMessenger) {<br>    channel = MethodChannel(binaryMessenger, &quot;premium_icon&quot;)<br>    channel.setMethodCallHandler { call, result -&gt;<br>     when (call.method) {<br>      &quot;updateToPremiumIcon&quot; -&gt; {<br>       updateToPremiumIcon()<br>       result.success(true)<br>      }<br>      &quot;updateToDefaultIcon&quot; -&gt; {<br>       updateToDefaultIcon()<br>       result.success(true)<br>      }<br>      else -&gt; result.notImplemented()<br>     }<br>    }<br>   }<br><br>  private fun updateToPremiumIcon() {<br>   changeIcon(&quot;PremiumActivity&quot;, &quot;MainActivity&quot;)<br>  }<br><br>  private fun updateToDefaultIcon() {<br>   changeIcon(&quot;MainActivity&quot;, &quot;PremiumActivity&quot;)<br>  }<br><br> private fun changeIcon(newActivity: String, oldActivity: String) {<br>  val packageManager = context.packageManager<br>  val newComponentName = ComponentName(context, &quot;$packageName.$newActivity&quot;)<br>  val oldComponentName = ComponentName(context, &quot;$packageName.$oldActivity&quot;)<br><br>  // Enable the new activity alias<br>  packageManager.setComponentEnabledSetting(<br>   newComponentName,<br>   PackageManager.COMPONENT_ENABLED_STATE_ENABLED,<br>   PackageManager.DONT_KILL_APP<br>  )<br><br>  // Disable the old activity alias<br>  packageManager.setComponentEnabledSetting(<br>   oldComponentName,<br>   PackageManager.COMPONENT_ENABLED_STATE_DISABLED,<br>   PackageManager.DONT_KILL_APP<br>  )<br> }<br>}</pre><p>And initialize the plugin in MainActivity .</p><p>That’s all we need to do for Android.</p><h3>iOS</h3><h4>Step 1:</h4><ul><li>Add the premium app icon set in the Assets Assets.xcassets.</li><li>Navigate to Assets -&gt; New iOS App Icon -&gt; add all the icon variations</li><li>Next, open Info.plist [open as source code] and add CFBundleIcons as shown below:</li></ul><pre>&lt;key&gt;CFBundleIcons&lt;/key&gt;<br>    &lt;dict&gt;<br>        &lt;key&gt;CFBundlePrimaryIcon&lt;/key&gt;<br>        &lt;dict&gt;<br>            &lt;key&gt;CFBundleIconFiles&lt;/key&gt;<br>            &lt;array/&gt;<br>            &lt;key&gt;UIPrerenderedIcon&lt;/key&gt;<br>            &lt;false/&gt;<br>        &lt;/dict&gt;<br>        &lt;key&gt;CFBundleAlternateIcons&lt;/key&gt;<br>        &lt;dict&gt;<br>            &lt;key&gt;PremiumAppIcon&lt;/key&gt;<br>            &lt;dict&gt;<br>                &lt;key&gt;CFBundleIconFiles&lt;/key&gt;<br>                &lt;array&gt;<br>                    &lt;string&gt;PremiumAppIcon&lt;/string&gt;<br>                &lt;/array&gt;<br>                &lt;key&gt;UIPrerenderedIcon&lt;/key&gt;<br>                &lt;true/&gt;<br>            &lt;/dict&gt;<br>        &lt;/dict&gt;<br>    &lt;/dict&gt;</pre><ul><li>You need to add your alternate icons [premium, festival, event etc..] in CFBundleAlternateIcons .</li><li>Ensure the string name matches the app icon name in the Assets.</li><li>In this case, I used PremiumAppIcon , so the string is PremiumAppIcon .</li></ul><h4>Step 2:</h4><p>Now, let’s create Swift Plugin.</p><ul><li>In Swift, we use the setAlternateIconName() method to change the app icon, which simplifies our task. Here’s the plugin code:</li></ul><pre>public class PremiumIconPlugin: NSObject, FlutterPlugin {<br> public static func register(with registrar: FlutterPluginRegistrar) {<br>        let channel = FlutterMethodChannel(name: &quot;premium_icon&quot;, binaryMessenger: registrar.messenger())<br>        let instance = PremiumIconPlugin()<br>        registrar.addMethodCallDelegate(instance, channel: channel)<br>    }<br> <br> public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {<br>     switch call.method {<br>     case &quot;updateToPremiumIcon&quot;:<br>         updateToPremiumIcon(result: result)<br>     case &quot;updateToDefaultIcon&quot;:<br>         updateToDefaultIcon(result: result)<br>     default:<br>         result(FlutterMethodNotImplemented)<br>     }<br>   }<br><br> private func updateToPremiumIcon(result: @escaping FlutterResult) {<br>        setAlternateIconName(iconName: &quot;PremiumAppIcon&quot;, result: result)<br>    }<br>    <br>    private func updateToDefaultIcon(result: @escaping FlutterResult) {<br>        setAlternateIconName(iconName: nil, result: result) // Passing nil to reset to default<br>    }<br>    <br>    private func setAlternateIconName(iconName: String?, result: @escaping FlutterResult) {<br>        if UIApplication.shared.supportsAlternateIcons {<br>            UIApplication.shared.setAlternateIconName(iconName) { error in<br>                DispatchQueue.main.async {<br>                    if let error = error {<br>                        print(&quot;Error changing app icon: \(error.localizedDescription)&quot;)<br>                        // Report the error back to Flutter<br>                        result(FlutterError(code: &quot;Icon Change Error&quot;, message: &quot;Failed to change icon: \(error.localizedDescription)&quot;, details: nil))<br>                    } else {<br>                        // Success, return true<br>                        result(true)<br>                    }<br>                }<br>            }<br>        } else {<br>            DispatchQueue.main.async {<br>                // If alternate icons are not supported, report it back to Flutter<br>                result(FlutterError(code: &quot;Unsupported&quot;, message: &quot;Alternate icons not supported&quot;, details: nil))<br>            }<br>        }<br>    }<br>}</pre><ul><li>Make sure the method channel name is consistent in both Android and iOS, as we use this method channel name in Flutter.</li><li>Use the same method names for both Android and iOS to maintain consistency.</li><li>To change the app icon to the default, pass nil to the setAlternateIconName method. To change to a specific icon, provide the IconName.</li></ul><h4>Note:</h4><p>There is an important setting to update for dynamic app icons:</p><p>Open XCode -&gt; Runner -&gt; TARGETS -&gt; Select your Runner -&gt; General -&gt; App Icons and Launch Screen -&gt; Select the check box with name include all app icon assets .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0gYj3rYhKuA62sj7FLdeg.png" /></figure><p>Don’t forget to initialize the plugin in AppDelegate.swift.</p><p>With these steps, we have successfully created the plugins for both Android and iOS.</p><h3>Final Part:</h3><h4>Setting Up in Flutter:</h4><p>Let’s create a premium_icon_changer.dart file and add the necessary methods to change the app icon.</p><pre>class PremiumIconChanger {<br>  static const MethodChannel _channel = MethodChannel(&#39;premium_icon&#39;);<br><br>  static Future&lt;void&gt; updateToDefaultIcon() async {<br>    try {<br>      await _channel.invokeMethod(&#39;updateToDefaultIcon&#39;);<br>    } on PlatformException catch (e) { //add if required<br>      print(&quot;Failed to change icon: ${e.message}&quot;);<br>    } on MissingPluginException catch (e) { //add if required<br>      print(&quot;Failed to change icon: ${e.message}&quot;);<br>    }<br>  }<br><br>  static Future&lt;void&gt; updateToPremiumIcon() async {<br>    try {<br>      await _channel.invokeMethod(&#39;updateToPremiumIcon&#39;);<br>    } on PlatformException catch (e) { //add if required<br>      print(&quot;Failed to change icon: ${e.message}&quot;);<br>    } on MissingPluginException catch (e) { //add if required<br>      print(&quot;Failed to change icon: ${e.message}&quot;);<br>    }<br>  }<br>}</pre><p><strong>Explanation:</strong></p><ol><li><strong>Method Channel:</strong></li></ol><ul><li>We define a MethodChannel named &#39;premium_icon&#39; to communicate with the platform-specific code.</li></ul><p><strong>2. Update to Default Icon:</strong></p><ul><li>The updateToDefaultIcon method invokes the updateToDefaultIcon method on the native side. If an error occurs, it prints the error message.</li></ul><p><strong>3. Update to Premium Icon:</strong></p><ul><li>The updateToPremiumIcon method invokes the updateToPremiumIcon method on the native side. Similarly, it prints any error messages that occur.</li></ul><p>Now, our class is complete. We just need to use these methods to update the app icon according to our requirements. For instance, you might call updateToPremiumIcon when a user purchases a premium subscription and updateToDefaultIcon when the premium subscription expires or is canceled.</p><h3>Conclusion</h3><p>Dynamic app icons can make your app more engaging by showing updates or special features. This guide covered how to set up dynamic icons for both Android and iOS and how to manage them from your Flutter app. By following these steps, you can provide a more personalized experience for your users.</p><p>If you found any errors in this article or have suggestions, please let me know on <a href="https://www.linkedin.com/in/suryajillellamudi/">LinkedIn</a>.</p><p>Thank you for Reading, and have a great day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=530551b2db93" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/implementing-dynamic-app-icons-in-flutter-a-step-by-step-guide-530551b2db93">Implementing Dynamic App Icons in Flutter: A Step-by-Step Guide</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamically Load Custom Fonts in Flutter]]></title>
            <link>https://medium.com/builtfordevs/dynamically-load-custom-fonts-in-flutter-660c1b04258b?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/660c1b04258b</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 12:47:11 GMT</pubDate>
            <atom:updated>2025-08-29T07:19:02.013Z</atom:updated>
            <content:encoded><![CDATA[<h3>Dynamically Load Custom Fonts in Flutter | Use Custom Fonts in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DD3Hd27Mq75JFUs_gehSCQ.jpeg" /></figure><p>Not a Member? <a href="https://blog.stackademic.com/dynamically-load-custom-fonts-in-flutter-660c1b04258b?sk=49a9b7bffe9172d93e032d77f9200d07">Click here</a></p><p>Custom fonts can greatly enhance the visual appeal of your Flutter application. While Google Fonts offers a vast selection, sometimes you may need a specific font not available there. This article will guide you through the process of dynamically loading custom fonts in Flutter.</p><h3>Why do we need Custom Fonts?</h3><p>Google Fonts offer a wide variety of fonts, so why do we need custom fonts? Despite the extensive collection available through Google Fonts, there are times when using a custom font is essential to make a strong impression on the user.</p><p>To achieve this, you can easily add the custom font to your assets and use it. However, what if you need to use numerous custom fonts? Adding all these fonts directly to your app would increase the app bundle size, which is not a best practice.</p><p>To avoid this, we need to load custom fonts dynamically. This approach serves our purpose without increasing the app bundle size.</p><p>Now, how do we load custom fonts dynamically?</p><h3>Load Custom Fonts Dynamically</h3><p>For that we will use the FontLoader class provided by the flutter.</p><p>For that first we need to download the Font!</p><pre>Future&lt;File&gt; downloadFont() async {<br>  final appDir = await getApplicationDocumentsDirectory();<br>  final fontFile = File(&#39;${appDir.path}/Custom-FontName&#39;);<br>  final response = await http.get(Uri.parse(&#39;https://yourhostedservice/Custom-FontName.ttf&#39;));<br>  await fontFile.writeAsBytes(response.bodyBytes);<br>  return fontFile;<br>}</pre><p><strong>Note: </strong>If you want to store the fonts in cache instead of data, you can use getTemporaryDirectory() and save the font there. The cache directory is suitable for temporary files that can be re-created or re-downloaded as needed. Be aware that files in the cache directory can be cleared by the system when the device is low on storage or when the user manually clears the app cache</p><p>Now we will use FontLoader class to load the Font.</p><pre>Future&lt;void&gt; loadFont() async {<br>  final fontFile = await downloadFont();<br>  final fontLoader = FontLoader(&#39;Custom FontName&#39;);<br>  fontLoader.addFont(getFontLoaderBytes(fontFile));<br>  await fontLoader.load();<br>}</pre><p>The method getFontLoaderBytes is designed to read the bytes from a given file and return them as a ByteData object, which can be useful for various purposes, such as loading custom fonts in a Flutter application.</p><p>Here is the method:</p><pre>Future&lt;ByteData&gt; getFontLoaderBytes(File file) async {<br>  final bytes = await file.readAsBytes();<br>  return ByteData.view(bytes.buffer);<br>}</pre><p>Now, here is the example for how to use it</p><pre>Text(<br>&quot;Hello Flutter!&quot;,<br>style: TextStyle(<br>fontFamily: &#39;Custom FontName&#39;, //your font name that you give in Font Loader<br>fontWeight: FontWeight.bold<br>))</pre><p>It’s as simple as that!</p><p>However, ensure that you load the font before navigating to the screen where you intend to use it to prevent any visual glitches.</p><p>Additionally, don’t forget to implement robust error handling.</p><p>Wait, there’s more! If we proceed this way, the font will be downloaded every time the app is opened. How can we avoid this redundancy?</p><h3>Avoid Redundancy</h3><p>To prevent redundant downloads, we need to store the font file locally. If a request for the same font is made again, we first check whether the font file already exists. If it does, we simply return the existing file.</p><p>Here is the Complete Code:</p><h4>Download:</h4><pre>Future&lt;File&gt; downloadFont({<br>    required String url,  // URL where the font is hosted<br>    required String fontName,<br>  }) async {<br>    try {<br>      final appDir = await getApplicationDocumentsDirectory(); // Use the path_provider package<br>      final fontFile = File(&#39;${appDir.path}/$fontName&#39;);<br>      if (await fontFile.exists()) {<br>        return fontFile;<br>      }<br><br>      final response = await http.get(Uri.parse(url));<br>      await fontFile.writeAsBytes(response.bodyBytes);<br>      return fontFile;<br>    } catch (e) {<br>      throw Exception(&#39;Failed to download the Font $e&#39;);<br>    }<br>  }</pre><h4>Load Font:</h4><pre>Future&lt;void&gt; loadFont(<br>      {required String url, required String fontName}) async {<br>    try {<br>      final fontFile = await downloadFont(url: url, fontName: fontName);<br>      final fontLoader = FontLoader(fontName);<br>      fontLoader.addFont(getFontLoaderBytes(fontFile));<br>      await fontLoader.load();<br>    } catch (e) {<br>      throw Exception(&quot;Failed to load font: $e&quot;);<br>    }<br>  }</pre><h4>Get Font Loader Bytes:</h4><pre>Future&lt;ByteData&gt; getFontLoaderBytes(File file) async {<br>    try {<br>      final bytes = await file.readAsBytes();<br>      return ByteData.view(bytes.buffer);<br>    } catch (e) {<br>      throw Exception(&quot;Failed to get font loader bytes: $e&quot;);<br>    }<br>  }</pre><p>And to reiterate, always load the font before using it!</p><h3>Conclusion</h3><p>Dynamically loading custom fonts in Flutter helps you get the perfect look without increasing your app size. Follow the steps to download, store, and use custom fonts efficiently. Enjoy creating a visually appealing and smooth app experience!</p><p>Thank you for reading! Have a great day.</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=660c1b04258b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/dynamically-load-custom-fonts-in-flutter-660c1b04258b">Dynamically Load Custom Fonts in Flutter</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Text Scaler in Flutter!]]></title>
            <link>https://medium.com/builtfordevs/text-scaler-in-flutter-340fa2ff46bc?source=rss-4f193276089f------2</link>
            <guid isPermaLink="false">https://medium.com/p/340fa2ff46bc</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Surya]]></dc:creator>
            <pubDate>Tue, 28 May 2024 07:33:24 GMT</pubDate>
            <atom:updated>2025-08-29T07:19:23.570Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QOqTrxrh3InUp_P4FhBmYA.jpeg" /></figure><p>Not a Member? <a href="https://medium.com/mobile-app-development-publication/text-scaler-in-flutter-340fa2ff46bc?sk=3a2193caae7e444af926d3fe3a879ac6">Click here</a></p><p>So we all know that flutter recently deprecated textScaleFactor by replacing it with textScaler.</p><p>So now we will learn what exactly text scaler is and also the migration guide from textScaleFactor to textScaler.</p><h3>Text Scaler</h3><p>A TextScaler in Flutter is a class that controls how text should be scaled for better readability. It allows you to adjust the size of text in a more flexible way, making it easier to read, especially for users who need larger or smaller text.</p><h3>Using TextScaler</h3><ol><li><strong>Creating a Text Scaler</strong></li></ol><ul><li>You can create a linear text scaler using TextScaler.linear(double scale).</li></ul><pre>Text(<br>&#39;Linear Text Scaler&#39;,<br>textScaler: TextScaler.linear(1.2) //Previously: textScaleFactor: 1.2<br>)</pre><p>2. Setting a Text Scaler in Media Query</p><ul><li>You can set a TextScaler for a widget subtree using MediaQuery.</li></ul><pre>MediaQuery(<br>data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(1.2)),<br>child: YourTextWidget(),<br>)</pre><p>3. Retrieving TextScaler</p><ul><li>Use MediaQuery.textScalerOf(context) to retrieve the current text scaler.</li></ul><pre>Text(<br>&quot;Flutter Text Scaler&quot;,<br>textScaler: MediaQuery.textScalerOf(context)<br>)</pre><ul><li>If you don’t want the font scale to cross certain number, we can use clamp.</li></ul><pre>Text(<br>&quot;Clamp Text Scaler&quot;,<br>textScaler: MediaQuery.textScalerOf(context)<br>                        .clamp(minScaleFactor: 1.0, maxScaleFactor: 1.2),<br>)</pre><ul><li>Scale Font Size using Text Scaler</li></ul><pre>final TextScaler textScaler = MediaQuery.textScalerOf(context);<br>final double baseFontSize = 20;<br><br>final double scaledFontSize = textScaler.scale(baseFontSize);<br><br>Text(<br>&quot;Scaled Font Size&quot;,<br>style: TextStyle(fontSize: scaledFontSize),<br>)</pre><h3>Conclusion</h3><p>In conclusion, the transition from textScaleFactor to textScaler in Flutter represents a significant improvement in managing text scaling, providing developers with more flexibility and precision. By adopting textScaler, you can enhance the readability of your app&#39;s text, accommodating users&#39; preferences and accessibility needs more effectively.</p><h4>References</h4><ul><li><a href="https://api.flutter.dev/flutter/painting/TextScaler-class.html">Text Scaler</a></li><li><a href="https://docs.flutter.dev/release/breaking-changes/deprecate-textscalefactor">Deprecate textScaleFactor in favor of TextScaler</a></li></ul><p>Thanks for reading! Have a Good Day.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=340fa2ff46bc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/builtfordevs/text-scaler-in-flutter-340fa2ff46bc">Text Scaler in Flutter!</a> was originally published in <a href="https://medium.com/builtfordevs">Tech Talk Digest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>