<?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 Sabin RanaBhat on Medium]]></title>
        <description><![CDATA[Stories by Sabin RanaBhat on Medium]]></description>
        <link>https://medium.com/@sawin0?source=rss-fc800cf900e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i4Pq2298B8K3PQnApcROAA.jpeg</url>
            <title>Stories by Sabin RanaBhat on Medium</title>
            <link>https://medium.com/@sawin0?source=rss-fc800cf900e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:59:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sawin0/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[Stop Leaking Your Keys: A Beginner’s Guide to Hiding Secrets in Flutter]]></title>
            <link>https://sawin0.medium.com/stop-leaking-your-keys-a-beginners-guide-to-hiding-secrets-in-flutter-bf3010fd052d?source=rss-fc800cf900e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf3010fd052d</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Sabin RanaBhat]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 15:29:51 GMT</pubDate>
            <atom:updated>2025-12-10T15:29:51.961Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L072bep6DDoA6L1fUcHVcQ.jpeg" /><figcaption><a href="https://sawin.com.np/_next/image?url=https%3A%2F%2Fiili.io%2FfRUjACv.webp&amp;w=3840&amp;q=75">https://sawin.com.np/_next/image?url=https%3A%2F%2Fiili.io%2FfRUjACv.webp&amp;w=3840&amp;q=75</a></figcaption></figure><p>New article out: how to securely manage secrets in your Flutter apps 🔒 — from Android and iOS config to Dart/.env-based keys.<br>If you build mobile apps or work in tech, this one could save you a lot of trouble.<br>👉 <a href="https://sawin.com.np/blog/hiding-secrets-in-flutter">https://sawin.com.np/blog/hiding-secrets-in-flutter</a></p><p>#Technology #MobileApps #AppSecurity #SoftwareEngineering #DevOps #SoftwareDevelopment #Tech #Programming #TechTips</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf3010fd052d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add App Shortcuts in Flutter: A Step‑by‑Step Quick Actions Guide]]></title>
            <link>https://sawin0.medium.com/add-app-shortcuts-in-flutter-a-step-by-step-quick-actions-guide-794b0985620f?source=rss-fc800cf900e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/794b0985620f</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[quick-action]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Sabin RanaBhat]]></dc:creator>
            <pubDate>Sun, 29 Jun 2025 09:24:40 GMT</pubDate>
            <atom:updated>2025-06-29T09:24:40.010Z</atom:updated>
            <content:encoded><![CDATA[<p>⚡ Want to add app shortcuts in your Flutter app? Here’s a step-by-step guide</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OBbBBpWUdLd2Qr4n8qh8Aw.png" /></figure><p>Quick Actions (aka app icon shortcuts) aren’t just fancy — they boost usability by letting users jump directly to key screens like Home or Profile</p><p><strong>Set Up quick_actions Plugin</strong></p><figure><img alt="Setup quick actions" src="https://cdn-images-1.medium.com/max/1024/0*I0Bho3hktZmgBUOK" /></figure><p>This registers static shortcuts for both Android and iOS.</p><p><strong>Handle Navigation Cleanly</strong><br>Use a GlobalKey&lt;NavigatorState&gt; to route without relying on context:</p><figure><img alt="Handle navigation" src="https://cdn-images-1.medium.com/max/1024/0*i-tMMq9aAG-IGWby" /></figure><p><strong>Initialize your quick actions logic</strong></p><figure><img alt="Initialize your quick actions" src="https://cdn-images-1.medium.com/max/810/0*cstTIcp6OlR_V7_F" /></figure><p><strong>Assets Matter: Icons Setup</strong><br> Android: Put PNGs or VectorDrawables (XML) in res/drawable/ <br> iOS: Add PNGs in Assets.xcassets, named as per icon field.</p><p><strong>See It in Action &amp; Dive Into Code</strong><br>🎥 Demo: <a href="https://youtube.com/shorts/Ndgr7DND_JA">https://youtube.com/shorts/Ndgr7DND_JA</a><br> 💻 Source: <a href="https://github.com/sawin0/quick_action_demo">https://github.com/sawin0/quick_action_demo</a></p><p>#Flutter #MobileDev #AppShortcuts #QuickActions #FlutterTutorial #Dart #Android #iOS #Learning #Tutorial</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=794b0985620f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimize Flutter Performance: Handle Heavy Image with Ease]]></title>
            <link>https://sawin0.medium.com/optimize-flutter-performance-handle-heavy-image-with-ease-0ef44d95d5ab?source=rss-fc800cf900e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ef44d95d5ab</guid>
            <category><![CDATA[optimize]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[image]]></category>
            <dc:creator><![CDATA[Sabin RanaBhat]]></dc:creator>
            <pubDate>Thu, 22 Feb 2024 15:37:05 GMT</pubDate>
            <atom:updated>2024-02-22T15:37:25.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLFF2CuR-BTOlXrcxSNYDQ.png" /></figure><p>Recently, I came across a property in Flutter: <strong>debugInvertOversizedImages</strong>.</p><p>You might think, What does it do? Okay, let me answer you. This property takes a boolean value, i.e., true or false; by default, it is false. If we make it true, then it will invert color and flip the images that are larger than their display size. With the help of this property, developers can easily stop oversized images on their app.</p><h4>How do I enable the debugInvertOversizedImages property?</h4><p>Go to your main.dart file. Inside the main method, add this line: debugInvertOversizedImages = true;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*i5v256gEr7ySYRny" /></figure><blockquote><em>Note: Do not release the app with the debugInvertOversizedImages property enabled.</em></blockquote><p>I have added a high-resolution image to my assets, and below is my demo implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/0*zJQSZ8e0OrL7U97f" /></figure><p>Now run your app. You can see all the oversized images being color-inverted and flipped by Flutter. Something similar to the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/0*bheQEwvxx6WL5KZ5" /></figure><p>And if you check your logs, then you might see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*TPhhHK3-TPFAxKS_" /></figure><p>Here, we are trying to load an image of 3688×4917, but actually, the display size is 1080×1493. And on the second line, we can see the solutions too.</p><p>Let’s try the first solution by adding the cacheHeight and cacheWidth parameters to the Image widget with the recommended dimensions provided by Flutter on the console. And your code should be similar to this.</p><p>Voilà, now your image will be displayed perfectly fine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/0*5DOfwf1uiSQfK7T4" /></figure><h4>Now, let’s try with ResizeImage.</h4><p>Before that, let’s learn what ResizeImage is.</p><p>Flutter’s ResizeImage class allows you to specify the desired dimensions at which images are decoded and cached instead of their full dimensions without altering the original image file. By resizing images to appropriate dimensions, we can significantly reduce memory usage and improve image loading time.</p><p>Now replace Image.asset with AssetImage, as ResizeImage takes image providers only. And set width and height to the same values we have added previously. We cannot display ResizeImage directly, so let’s wrap it in the Image widget. Your implementation should look something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/0*nnw_I8YHs-Rxg4IV" /></figure><p>If both do the same thing, then what’s the difference? You might be wondering.</p><p>The ‘cacheWidth’ and ‘cacheHeight’ parameters of Image.asset are used for static resizing images before loading into the UI and remain the same for the whole lifetime of the app. The ResizeImage class is used for dynamic resizing of images at runtime and is generated every time the ImageProvide is used.</p><p>If you ask for my recommendation, I recommend you use the former one. Yes, cacheWidth’ and ‘cacheHeight’ parameters of the Image widget. This can be used on Image.assets, <a href="http://image.network/">Image.network</a>, Image.file, and Image.memory.</p><h4>What if you are using the cache_networked_image package instead of Image.network?</h4><p>You can pass your desired dimension value to the memCacheHeight and memCacheWidth properties of the CachedNetworkImage class. If you are using the CachedNetworkImageProvider class, then you don’t have access to these properties. Instead, you should wrap it under ResizeImage.</p><h4>Bonus: Dynamically determining image cache size by Extensions and MediaQuery class.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*RnwIO-IhMOqGzHy1" /></figure><p>The usage of ImageExtension is pretty simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/0*kCo9MnxFxE5bqKop" /></figure><h4>Conclusion:</h4><p>In this article, we explored how to load heavy images efficiently and optimize performance when displaying heavy images from assets and networks.</p><h4>Links:</h4><ul><li><a href="https://api.flutter.dev/flutter/painting/debugInvertOversizedImages.html">https://api.flutter.dev/flutter/painting/debugInvertOversizedImages.html</a></li><li><a href="https://api.flutter.dev/flutter/painting/ResizeImage-class.html">https://api.flutter.dev/flutter/painting/ResizeImage-class.html</a></li><li><a href="https://github.com/flutter/flutter/issues/56239">https://github.com/flutter/flutter/issues/56239</a></li><li><a href="https://gist.github.com/sawin0/db869b972e9bb76ae986a0d3d56e0d92">https://gist.github.com/sawin0/db869b972e9bb76ae986a0d3d56e0d92</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ef44d95d5ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Parallelism on Flutter: Main Thread, Isolate and Compute.]]></title>
            <link>https://sawin0.medium.com/exploring-parallelism-on-flutter-main-thread-isolate-and-compute-671988cf445e?source=rss-fc800cf900e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/671988cf445e</guid>
            <category><![CDATA[computes]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[isolate]]></category>
            <category><![CDATA[parallelism]]></category>
            <dc:creator><![CDATA[Sabin RanaBhat]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 05:09:13 GMT</pubDate>
            <atom:updated>2024-02-19T05:09:13.068Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nH_4j4Ff1TqtnC6Ma0AX0A.png" /></figure><ul><li><strong>Main Thread</strong>: We all know Dart (Flutter) code runs in a single thread, which is a main thread aka main isolate. This thread is responsible for painting UI, handling user interaction and responding to the user interactions. Below you can see an example where I am fetching data on the main thread, that might overload the main thread and lead to sluggish performance and unresponsive UI, causing a jarring experience for users.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*otO2DrIO_hKUJavP" /></figure><ul><li><strong>Isolate</strong>: Dart introduces Isolate to achieve true parallelism. Isolate has its own memory space that allow to perform computation without blocking the main thread. Communication between isolates is done using ports: ‘SendPort’ and ‘ReceivePort’. Below is an example of isolate where I am fetching data using isolate without hampering the main thread.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kWGcsLL1_KVtpXoy" /></figure><ul><li><strong>Compute</strong>: Just above we read about isolate now what is ‘compute’? Isolate provides parallelism, but, manually handling them could be a tedious task, so Dart has provided us a compute method which provides parallelism without having to create ports like in the isolates. Below is an example of a compute method from which I am fetching data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HyDir4CO9ql-7bYN" /></figure><p><strong>Performance</strong>:</p><p>I tested all three ways to fetch the data and here’s the result. Isolate is faster than others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-PzJUB_0KYqEAMTZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6JN0fZ4Tlx9URjz7" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1Roq88VUJ9mL-JTZ" /></figure><p><strong>Choosing the Right Tool for the Job</strong>:</p><ul><li>Main thread: Stick to UI updates, animations, and user interactions.</li><li>Isolates: Use for computationally intensive tasks, network requests, and background processing.</li><li>Compute: Ideal for short-lived, simple calculations.</li></ul><p><strong>Things to remember</strong>:</p><ul><li>Communication: Isolates require message passing for communication, while compute doesn’t.</li><li>Complexity: Isolates offer more control but require more setup, while compute is simpler but less flexible.</li><li>Memory: Isolates have separate memory spaces, while compute shares the main thread’s memory.</li></ul><p><strong>Conclusion</strong>:</p><p>Understanding the nuances of main thread, isolates, and compute empowers you to make informed decisions about concurrency in your Flutter projects. By leveraging these tools strategically, you can ensure a smooth, responsive, and performant user experience, taking your Flutter apps to the next level!</p><p>Bonus Tip: Experiment with different approaches and measure performance to find the optimal solution for your specific use case.</p><p>I hope this article provides a clear and concise explanation of these concurrency concepts in Flutter. Feel free to ask if you have any further questions or need more specific examples!</p><p>#Flutter #DartLang #MobileDevelopment #Concurrency #Isolates #ComputeFunction #MainThread #UIPerformance #FlutterDev #Programming #CodeOptimization #ParallelProgramming #MobileApps #DeveloperTips #FlutterCommunity #Coding #AppDevelopment #SoftwareEngineering #TechArticles #TechTips #PerformanceOptimization</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=671988cf445e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concurrent Asynchronous Operations in Dart: A Guide to Future.wait]]></title>
            <link>https://sawin0.medium.com/concurrent-asynchronous-operations-in-dart-a-guide-to-future-wait-5f39b4addb0b?source=rss-fc800cf900e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f39b4addb0b</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[concurrency]]></category>
            <dc:creator><![CDATA[Sabin RanaBhat]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 05:02:22 GMT</pubDate>
            <atom:updated>2024-02-13T05:02:22.059Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tyuk63KHgHMY33Q7sUB8lw.png" /></figure><h4>Introduction:</h4><p>Dart has provided a method “Future.wait” that provides an efficient way to handle multiple asynchronous operations concurrently. This is useful when you have several async functions that need to be executed before performing any operation. Please note that these async functions should be independent of each other.</p><p>Let’s consider you have to fetch data from 10 different APIs that are not dependent on each other. For the demo, I am using JSON Placeholder API to fetch To-dos.</p><p>Firstly, implement the API, it’s pretty simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XCWp8955aYb_t5v9" /></figure><p>On the second step, let’s create a list of API calls</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3nrBAh3OPUiao9ff" /></figure><p>Then, pass the list of API calls that we have created to the Future.wait() method. And then await for the result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oakBLeY3Imj2Hf4L" /></figure><p>Done, you have successfully implemented Future.wait() and handled multiple asynchronous operations efficiently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*ytp1la5Mx_AyeJjm" /></figure><p>You might be thinking, aren’t we missing anything? Yes, we are.</p><h4><strong>Error Handling.</strong></h4><p>On our async function we are throwing an exception, to handle that we need to surround Future.wait() with try catch block like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xx28MNAdrKfj5Zrt" /></figure><p>If you want to do some cleanup, then you can create a function where you handle cleanup. Clean up function is used for closing DB, file or any connection and so on.</p><p>Note: cleanup function will be only executed if any async function completes with an error.</p><p>Here’s the complete code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MSKigL9R-3daKojU" /></figure><h4><strong>Comparing the execution time of Future.wait() with multiple await statements.</strong></h4><p>Fetching 10 APIs using Future.wait() method take only 31ms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lnkBBkuv5QDfQtZt" /></figure><p>Using await</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ja83SlSVEZeh-r9p" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6PEWQ_tiDRxatPds" /></figure><p>You can see that, Future.wait() does the same task a lot faster than using individual await on all each async function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*YdRgZQA6X7tJd5i5" /></figure><blockquote>Less is better.</blockquote><h4>Conclusion:</h4><p>In conclusion, Future.wait() method is a way more efficient for handling multiple async operations which are independent of each other. By using Future.wait, developers can streamline their code and enhance overall performance.</p><p>I hope you found this guide on Dart’s Future.wait helpful! Your feedback matters. If you have questions, suggestions, or specific topics you’d like more coverage on, please leave a comment. Your insights help improve future content to better suit your needs. Thanks for reading! 🚀</p><h4>Link:</h4><ol><li><a href="https://api.flutter.dev/flutter/dart-async/Future/wait.html">https://api.flutter.dev/flutter/dart-async/Future/wait.html</a></li><li><a href="https://gist.github.com/sawin0/1f6524be429ac20fc94dc1b1f4771791">https://gist.github.com/sawin0/1f6524be429ac20fc94dc1b1f4771791</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f39b4addb0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>