<?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 parththinksaloud on Medium]]></title>
        <description><![CDATA[Stories by parththinksaloud on Medium]]></description>
        <link>https://medium.com/@parththinksaloud?source=rss-5142df7cd8c7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1nbPeqdwxOIYkscQAunmBA.jpeg</url>
            <title>Stories by parththinksaloud on Medium</title>
            <link>https://medium.com/@parththinksaloud?source=rss-5142df7cd8c7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:51:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@parththinksaloud/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[You Don’t Need to Memorize Code to Be a Better Programmer]]></title>
            <link>https://medium.com/@parththinksaloud/you-dont-need-to-memorize-code-to-be-a-better-programmer-4c61b060e9c8?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c61b060e9c8</guid>
            <category><![CDATA[code-first]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 11:10:45 GMT</pubDate>
            <atom:updated>2026-10-05T11:10:45.274Z</atom:updated>
            <content:encoded><![CDATA[<p>When I started programming, I thought good programmers were people who remembered every line of syntax. Back in school, we memorized programs the way we memorized answers for exams, and I carried that habit into coding.</p><p>It took me a while to realize I had it backwards.</p><h3>1. Coding is not about memorizing. It’s about understanding</h3><p>Think about how you learned to ride a bicycle. Nobody gave you a manual with 500 rules. You understood balance once, and after that it stayed with you.</p><p>Programming works the same way. Once you truly understand a concept (how a loop works, what a function does, how data flows through a program), you don’t have to “re-learn” it every time. You understand it once, and you apply it everywhere.</p><p>Rereading code you’ve written, or code you’ve copied, won’t make you better. Asking <em>“why does this work?”</em> will.</p><h3>2. Syntax changes. Logic doesn’t</h3><p>There are hundreds of programming languages: Python, Java, Kotlin, JavaScript, Dart, C#, and more. It’s tempting to think you must learn the syntax of all of them to become a good developer.</p><p>You don’t.</p><p>Look at this simple idea: <em>“Go through a list of numbers and print the even ones.”</em></p><p>The logic is identical in every language:</p><ol><li>Take each item in the list</li><li>Check if it is divisible by 2</li><li>If yes, print it</li></ol><p>Only the syntax changes. In Python it’s a for loop with an if. In Kotlin it&#39;s a for loop with an if too, just with different brackets and keywords. If you understand the logic, a quick Google search or the documentation will give you the syntax in seconds.</p><p><strong>Nobody expects you to remember every line of code.</strong> Professional developers search for syntax every single day. What they don’t search for is how to think through a problem.</p><h3>3. Learn one language and master the concepts</h3><p>Don’t jump between five languages in your first year. That’s the fastest way to feel like you’re learning a lot while actually learning nothing deeply.</p><p>Instead:</p><ul><li><strong>Pick one language</strong> (Python is a friendly choice, but any will do)</li><li><strong>Master the fundamentals</strong>: variables, conditions, loops, functions, data structures, and object-oriented ideas</li><li><strong>Build real things</strong>, even small ones, because projects teach what tutorials can’t</li><li><strong>Then expand.</strong> Once you know one language well, the second takes a fraction of the time, because you’re only learning new syntax, not new thinking</li></ul><p>It isn’t hard, but it does need focus. An hour of focused practice beats five hours of distracted tutorial-watching.</p><h3>4. Practical habits that make you better</h3><ul><li><strong>Read other people’s code.</strong> You’ll learn patterns you’d never invent alone.</li><li><strong>Break problems into small steps</strong> before writing any code.</li><li><strong>Debug on your own first.</strong> Struggling for a bit builds the instinct that makes you faster later.</li><li><strong>Build, break, repeat.</strong> Every bug you fix is a lesson you won’t forget.</li></ul><h3>Final thoughts</h3><p>Being a better programmer isn’t about having a perfect memory. It’s about thinking clearly, understanding concepts deeply, and being comfortable looking things up. Focus on the logic, and the syntax will follow.</p><p>So the next time you forget how to write a loop in a language you haven’t used for a month, don’t worry. You haven’t forgotten how to code. You’ve just forgotten some syntax, and that’s fine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c61b060e9c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use AdMob in Flutter (2026 Guide): Setup + Loading Every Ad Format]]></title>
            <link>https://medium.com/@parththinksaloud/how-to-use-admob-in-flutter-2026-guide-setup-loading-every-ad-format-8599e6d736ec?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8599e6d736ec</guid>
            <category><![CDATA[flutter-admob]]></category>
            <category><![CDATA[admob]]></category>
            <category><![CDATA[flutter-ads]]></category>
            <category><![CDATA[admob-interstitial-ads]]></category>
            <category><![CDATA[flutter-add-set-up]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Fri, 21 Aug 2026 07:32:05 GMT</pubDate>
            <atom:updated>2026-08-21T07:32:05.308Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqfvwKs9G_ZPRCviJOpHBw.png" /></figure><p>Monetizing a Flutter app almost always starts in the same place: Google AdMob. It’s still the most widely used mobile ad network, and the official google_mobile_ads plugin is the cleanest way to wire it into a Flutter app on both Android and iOS.</p><p>This guide walks through the full setup and shows how to load every major ad format banner, interstitial, rewarded, rewarded interstitial, native, and app open using the current (2026) version of the SDK.</p><h3>What’s new going into 2026</h3><p>A few things changed that are worth knowing before you start:</p><ul><li>The plugin now ships on <strong>Google Mobile Ads SDK 25.3.0</strong>, built on the newer <strong>Next‑Gen SDK (1.1.0)</strong>, with iOS on GMA 13.3.0 and the Android <strong>UMP SDK bumped to 4.0.0</strong> for consent handling.</li><li>The plugin’s Dart SDK constraint moved up to <strong>3.10.0</strong>, so make sure your Flutter/Dart toolchain is current.</li><li>iOS integration now supports <strong>Swift Package Manager</strong>, alongside CocoaPods.</li><li>Two adaptive banner helper methods were deprecated in favor of new ones: use getLargeAnchoredAdaptiveBannerAdSize and getLargeAnchoredAdaptiveBannerAdSizeWithOrientation instead of the old getCurrentOrientationAnchoredAdaptiveBannerAdSize / getAnchoredAdaptiveBannerAdSize.</li><li>Minimum supported Flutter version for the plugin is <strong>3.27.0+</strong>.</li></ul><h3>1. Add the dependency</h3><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  google_mobile_ads: ^latest</pre><p>Run flutter pub get. Always check pub.dev for the exact latest version tag before publishing.</p><h3>2. Platform configuration</h3><h3>Android — android/app/src/main/AndroidManifest.xml</h3><p>Add your AdMob App ID (format ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY) inside the &lt;application&gt; tag:</p><pre>&lt;manifest&gt;<br>  &lt;application&gt;<br>    &lt;meta-data<br>        android:name=&quot;com.google.android.gms.ads.APPLICATION_ID&quot;<br>        android:value=&quot;ca-app-pub-3940256099942544~3347511713&quot;/&gt;<br>  &lt;/application&gt;<br>&lt;/manifest&gt;</pre><p>(That value above is Google’s public <strong>test</strong> App ID — safe to use while developing.)</p><p>iOS — ios/Runner/Info.plist</p><pre>&lt;key&gt;GADApplicationIdentifier&lt;/key&gt;<br>&lt;string&gt;ca-app-pub-3940256099942544~1458002511&lt;/string&gt;</pre><p>If you’re on the newer plugin versions with Swift Package Manager support, follow the plugin’s iOS setup notes for SPM vs. CocoaPods — both are supported, but don’t mix partial configuration from both.</p><h3>3. Initialize the SDK</h3><p>Do this once, before runApp:</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:google_mobile_ads/google_mobile_ads.dart&#39;;<br><br>Future&lt;void&gt; main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await MobileAds.instance.initialize();<br>  runApp(const MyApp());<br>}</pre><p>If you’re targeting EEA/UK users, this is also where you’d run the User Messaging Platform (UMP) consent flow before requesting ads — the plugin bundles UMP support so you don’t need a separate package.</p><h3>4. Loading each ad format</h3><p>Always use <strong>test ad unit IDs</strong> during development. Google publishes fixed test IDs for every format — swap in your real IDs only for release builds, and never test-click your own live ads.</p><h3>Banner ads</h3><pre>BannerAd? _bannerAd;<br><br>void _loadBanner() {<br>  _bannerAd = BannerAd(<br>    adUnitId: &#39;ca-app-pub-3940256099942544/6300978111&#39;, // test ID<br>    size: AdSize.banner,<br>    request: const AdRequest(),<br>    listener: BannerAdListener(<br>      onAdLoaded: (ad) =&gt; setState(() {}),<br>      onAdFailedToLoad: (ad, error) {<br>        ad.dispose();<br>      },<br>    ),<br>  )..load();<br>}</pre><p>Render it with AdWidget(ad: _bannerAd!) once loaded, wrapped in a SizedBox matching the ad&#39;s width/height. For a banner that adapts to screen width, use AdSize.getAnchoredAdaptiveBannerAdSize — or, per the note above, the newer getLargeAnchoredAdaptiveBannerAdSize variant.</p><h3>Interstitial ads</h3><pre>InterstitialAd? _interstitialAd;<br><br>void _loadInterstitial() {<br>  InterstitialAd.load(<br>    adUnitId: &#39;ca-app-pub-3940256099942544/1033173712&#39;, // test ID<br>    request: const AdRequest(),<br>    adLoadCallback: InterstitialAdLoadCallback(<br>      onAdLoaded: (ad) {<br>        _interstitialAd = ad;<br>        ad.fullScreenContentCallback = FullScreenContentCallback(<br>          onAdDismissedFullScreenContent: (ad) =&gt; ad.dispose(),<br>          onAdFailedToShowFullScreenContent: (ad, error) =&gt; ad.dispose(),<br>        );<br>      },<br>      onAdFailedToLoad: (error) =&gt; _interstitialAd = null,<br>    ),<br>  );<br>}<br><br>void _showInterstitial() {<br>  _interstitialAd?.show();<br>}</pre><p>Load interstitials <strong>ahead of time</strong> (e.g., right after a screen loads) and only call .show() at a natural break point — level completion, between screens, etc. Loading on demand causes visible delay.</p><h3>Rewarded ads</h3><pre>RewardedAd? _rewardedAd;<br><br>void _loadRewarded() {<br>  RewardedAd.load(<br>    adUnitId: &#39;ca-app-pub-3940256099942544/5224354917&#39;, // test ID<br>    request: const AdRequest(),<br>    rewardedAdLoadCallback: RewardedAdLoadCallback(<br>      onAdLoaded: (ad) =&gt; _rewardedAd = ad,<br>      onAdFailedToLoad: (error) =&gt; _rewardedAd = null,<br>    ),<br>  );<br>}<br><br>void _showRewarded() {<br>  _rewardedAd?.show(<br>    onUserEarnedReward: (ad, reward) {<br>      // grant the in-app reward here<br>    },<br>  );<br>}</pre><h3>Rewarded interstitial ads</h3><p>Same pattern as rewarded, just swap the class:</p><pre>RewardedInterstitialAd.load(<br>  adUnitId: &#39;ca-app-pub-3940256099942544/5354046379&#39;, // test ID<br>  request: const AdRequest(),<br>  rewardedInterstitialAdLoadCallback: RewardedInterstitialAdLoadCallback(<br>    onAdLoaded: (ad) =&gt; _rewardedInterstitialAd = ad,<br>    onAdFailedToLoad: (error) =&gt; _rewardedInterstitialAd = null,<br>  ),<br>);</pre><p>Use this format for ads that show automatically at transition points but still let the user opt out and still reward completion.</p><h3>Native ads</h3><pre>NativeAd _nativeAd = NativeAd(<br>  adUnitId: &#39;ca-app-pub-3940256099942544/2247696110&#39;, // test ID<br>  factoryId: &#39;listTile&#39;, // registered on the platform side<br>  request: const AdRequest(),<br>  listener: NativeAdListener(<br>    onAdLoaded: (ad) =&gt; setState(() {}),<br>    onAdFailedToLoad: (ad, error) =&gt; ad.dispose(),<br>  ),<br>)..load();</pre><p>Show this when the app resumes from the background — commonly wired up via an AppLifecycleListener — but never on true cold start, since that delays whatever the user actually opened the app to do.</p><h3>5. Loading ads efficiently — the “preload and hold” pattern</h3><p>The common mistake is calling .load() right when you need to .show() an ad. For anything full-screen (interstitial, rewarded, rewarded interstitial, app open), load the <strong>next</strong> ad as soon as the <strong>current</strong> one is dismissed or fails, so there&#39;s always one warm in memory:</p><pre>onAdDismissedFullScreenContent: (ad) {<br>  ad.dispose();<br>  _loadInterstitial(); // pre-fetch the next one immediately<br>},</pre><p>Banners and native ads are simpler since they load into a visible slot directly — but still dispose of them in dispose() to avoid memory leaks, and avoid reloading a banner that&#39;s already on screen.</p><h3>6. Before you ship</h3><ul><li>Swap every test ad unit ID for your real ones from the AdMob console.</li><li>Run the UMP consent flow for GDPR/UK users before any ad request if you have EU traffic.</li><li>Respect Google’s policies on ad placement and click encouragement — accidental clicks are a fast way to get a publisher account suspended.</li><li>Test on a real device close to release; some ad-loading edge cases don’t show up in emulators.</li></ul><p>That covers the full loop: SDK setup, platform config, initialization, and every ad format you’re likely to ship in a production Flutter app in 2026. From here, the main lever left to pull is mediation — layering in additional ad networks through AdMob’s mediation dashboard to improve fill rate and eCPM, which is worth its own follow-up post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8599e6d736ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Networking: Dio vs. Http-Which One Should You Choose?]]></title>
            <link>https://medium.com/@parththinksaloud/flutter-networking-dio-vs-http-which-one-should-you-choose-74791a274273?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/74791a274273</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[flutter-dio]]></category>
            <category><![CDATA[dios]]></category>
            <category><![CDATA[flutter-dio-vs-https]]></category>
            <category><![CDATA[flutter-api-calling]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 13:37:19 GMT</pubDate>
            <atom:updated>2026-06-09T13:37:19.994Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7CdbAz3FXM0O5eMSWNaFw.png" /></figure><p>When building a production-ready Flutter application, one of the architectural pillars you must establish early on is <strong>networking</strong>. How your app communicates with backend APIs affects everything from performance and security to code readability and maintainability.</p><p>In the Flutter ecosystem, two packages dominate the networking landscape: <strong>http</strong> and <strong>dio</strong>.</p><p>While both serve the ultimate purpose of making network requests, they approach the problem with entirely different philosophies. In this article, we’ll break down the core differences, examine code side-by-side, and help you decide which one fits your project best.</p><h3>The Contenders at a Glance</h3><h3>1. The http Package</h3><p>Maintained by the official Dart team, http is a composable, multi-platform library for making HTTP requests. It is minimal, lightweight, and follows the philosophy of <em>&quot;doing one thing and doing it well.&quot;</em></p><ul><li><strong>Best for:</strong> Small to medium projects, simple REST API consumption, and developers who prefer a minimalist footprint.</li><li><strong>Philosophy:</strong> Provide the bare essentials. If you need advanced features, you build them yourself.</li></ul><h3>2. The Dio Package</h3><p>Dio is a powerful, feature-rich HTTP client for Dart/Flutter. It comes out-of-the-box with advanced features that you would otherwise have to write boilerplate code for if you used http.</p><ul><li><strong>Best for:</strong> Enterprise apps, large-scale projects, and apps requiring complex network operations (like file downloading/uploading progress, request cancellation, or global error handling).</li><li><strong>Philosophy:</strong> Provide a robust, batteries-included toolkit to handle any networking scenario.</li></ul><h3>Head-to-Head Comparison: 5 Key Architectural Differences</h3><p>To understand why you might choose one over the other, let’s look at how they handle common real-world development scenarios.</p><h3>1. Setup and Global Configuration</h3><p>With http, every request is essentially standalone unless you write a wrapper class. Dio, on the other hand, allows you to create a base instance with a default configuration (Base URL, timeouts, headers) that applies to all requests.</p><p><strong>With Dio:</strong></p><pre>BaseOptions options = BaseOptions(<br>  baseUrl: &quot;https://api.example.com&quot;,<br>  connectTimeout: Duration(seconds: 5),<br>  receiveTimeout: Duration(seconds: 3),<br>);<br><br>Dio dio = Dio(options);</pre><h3>2. Interceptors (The Game Changer)</h3><p>Interceptors are functions that can intercept, modify, or block network requests and responses before they hit the server or your application logic. This is crucial for adding JWT auth tokens, refreshing expired tokens, or logging.</p><ul><li><strong>http:</strong> Does not natively support interceptors. You must manually extend the BaseClient and override methods to inject logic.</li><li><strong>Dio:</strong> Has built-in support for interceptors. You can easily chain multiple interceptors for logging, authentication, and error handling.</li></ul><p><strong>Dio Interceptor Example:</strong></p><pre>dio.interceptors.add(InterceptorsWrapper(<br>  onRequest: (options, handler) {<br>    // Automatically inject a token into every request header<br>    options.headers[&quot;Authorization&quot;] = &quot;Bearer $token&quot;;<br>    return handler.next(options); <br>  },<br>  onError: (DioException e, handler) {<br>    if (e.response?.statusCode == 401) {<br>      // Handle token expiration / auto-refresh token here!<br>    }<br>    return handler.next(e);<br>  },<br>));</pre><h3>3. Automatic JSON Parsing</h3><p>Modern APIs communicate in JSON. How both packages handle this data highlights their difference in convenience.</p><ul><li><strong>http:</strong> Returns the response body as a raw String. You must manually use jsonDecode(response.body).</li><li><strong>Dio:</strong> Automatically detects the content type. If the server returns JSON, response.data is automatically converted into a Dart Map or List.</li></ul><pre>// Using http //<br>final response = await http.get(Uri.parse(&#39;https://api.example.com/user&#39;));<br>final map = jsonDecode(response.body); /// Manual step required<br>print(map[&#39;name&#39;]);<br><br>// Using Dio//<br>final response = await dio.get(&#39;/user&#39;);<br>print(response.data[&#39;name&#39;]); /// Automatically decoded!=</pre><h3>4. Advanced Request Operations (Cancellation &amp; Progress tracking)</h3><p>Imagine a user starts uploading a heavy video file, or navigates away from a page while a slow profile image is downloading. You need to track the progress or cancel the request entirely to save bandwidth.</p><ul><li><strong>http:</strong> Tracking upload/download percentages or cancelling an active request requires complex streams and low-level HTTP client manipulations.</li><li><strong>Dio:</strong> Provides native callbacks and cancellation tokens out of the box.</li></ul><pre>// Tracking upload progress in Dio<br>await dio.post(<br>  &quot;/upload&quot;,<br>  data: formData,<br>  onSendProgress: (int sent, int total) {<br>    print(&quot;Progress: ${(sent / total * 100).toStringAsFixed(0)}%&quot;);<br>  },<br>);</pre><h3>5. Error Handling</h3><p>When a network call fails, knowing <em>why</em> it failed is crucial for a smooth user experience.</p><ul><li><strong>http:</strong> Throws generic exceptions (like SocketException or ClientException). If the server returns a 404 or 500 status code, http considers it a successful execution flow; you must check response.statusCode manually.</li><li><strong>Dio:</strong> Wraps all network anomalies into a dedicated DioException. If the server returns a 4xx or 5xx status code, Dio automatically throws an error, allowing you to catch server errors gracefully in a try-catch block.</li></ul><h3>The Verdict: Which one should you choose?</h3><h3>Choose http if:</h3><ul><li>You are building a small app, a hobby project, or a quick prototype.</li><li>Your app only interacts with 1 or 2 simple endpoints and doesn’t require complex authentication flows.</li><li>You are ultra-sensitive about keeping your app’s dependency footprint as small as possible.</li></ul><h3>Choose Dio if:</h3><ul><li>You are building a production-grade or enterprise-scale application.</li><li>You need to handle complex auth mechanisms like <strong>OAuth2 refresh token flows</strong> (which are incredibly easy with Dio Interceptors).</li><li>Your app involves heavy file operations (uploading profile pictures, downloading PDFs with progress indicators).</li><li>You want a unified global error handling system for all API requests.</li></ul><h3>Conclusion</h3><p>Neither package is objectively “better” than the other; it’s a matter of choosing the <strong>right tool for the right job</strong>. The http package gives you a blank canvas with minimal overhead, while Dio gives you a fully-equipped powerhouse that saves you from writing hundreds of lines of boilerplate code.</p><p>For most professional Flutter applications, <strong>Dio tends to be the industry standard</strong> because of how much time it saves down the line as your application grows.</p><p><strong><em>What is your go-to networking package in Flutter? Let’s discuss!</em></strong></p><p><em>Enjoyed this article? Don’t forget to </em><strong><em>clap</em></strong><em> 👏 and </em><strong><em>follow</em></strong><em> for more practical Flutter guides!</em></p><p><strong>Happy Coding!</strong> 💙</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74791a274273" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Hardcoding Pixels: The Production Blueprint for Responsive Flutter UIs]]></title>
            <link>https://medium.com/@parththinksaloud/stop-hardcoding-pixels-the-production-blueprint-for-responsive-flutter-uis-cb1f876df799?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb1f876df799</guid>
            <category><![CDATA[responsive-design]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter-ui-design]]></category>
            <category><![CDATA[flutter-responsive-ui]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 07:23:38 GMT</pubDate>
            <atom:updated>2026-06-02T07:23:38.385Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgzAOrlOQKk8fxRhIAYUzQ.png" /></figure><p>Forget MediaQuery multipliers. Learn how enterprise-grade Flutter systems achieve seamless adaptability across Mobile, Foldables, Tablets, and Web.</p><p>After nearly a decade of shipping commercial Flutter applications — scaling across tiny budget Android screens, premium foldables, enterprise tablets, and high-res desktop monitors — I’ve noticed a recurring pattern. Most developers approach responsiveness entirely backward. They build an interface for a generic smartphone, inspect it on a couple of simulators, and then litter the codebase with random MediaQuery.of(context).size multipliers to force elements to &quot;fit.&quot;</p><p>That isn’t responsiveness. That’s guessing. When you stretch a mobile layout proportionally onto an iPad, you don’t get an optimized tablet experience — you just get a comically oversized phone app.</p><p>As the old developer rule goes: <strong>Less code, fewer bugs.</strong> If you want your application to look professional, perform flawlessly, and scale across platforms, you need an architecture centered on adaptive mechanics, strict parent constraints, and defensive UI design.</p><h3>1. The Core Philosophy: “Constraints Go Down”</h3><p>In Flutter’s rendering engine, layout rules are governed by a strict, three-phrase mantra: <strong>Constraints go down. Sizes go up. Parent sets the position.</strong></p><p>A senior developer rarely tells a widget its exact dimensions. Instead, you design your layout tree to pass down boundaries, allowing the child widgets the complete flexibility to adapt gracefully to the box they are given. To achieve this, throw away hardcoded dimensions (e.g., width: 340) and embrace the native constraint system:</p><ul><li><strong>LayoutBuilder:</strong> The single most critical tool in your responsive toolkit. It doesn’t look at the screen dimensions; it checks the maximum and minimum width/height provided by the <em>immediate parent</em>. This lets you build truly modular, self-contained components that adapt whether they are inside a full screen, a modal sheet, or a sidebar panel.</li><li><strong>Flex, Flexible, and Expanded:</strong> Let Flutter’s flex engine calculate dynamic spaces. Instead of using hardcoded empty SizedBox containers for margins, use Spacer() elements with flex factors to distribute remaining layout gaps mathematically.</li><li><strong>AspectRatio:</strong> Essential for media elements, dashboard cards, and camera feeds. This forces an element to scale up or down smoothly without losing its composition ratio.</li></ul><blockquote><strong>💡 Field Pro-Tip:</strong> Never size your typography using screen width percentages (width * 0.05). When a user switches to a tablet or a multi-window desktop setup, your text will expand to an unreadable, massive size. Instead, use localized text scales, specify strict maximum/minimum bounds, or rely purely on standard Material Design Type Scales via Theme.of(context).textTheme.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*d3vtX-y4McvH0nubbDAEtQ.jpeg" /></figure><h3>2. Clean Centralization of Responsive Breakpoints</h3><p>Scatter-brained layout checks like if (MediaQuery.of(context).size.width &gt; 600) repeated inside various view files will completely derail your codebase maintainability. A senior approach requires a single source of truth for device classifications.</p><p>Additionally, stop calling the heavy MediaQuery.of(context). In modern versions of Flutter, use MediaQuery.sizeOf(context). It targets <em>only</em> size alterations, preventing your widget from needlessly rebuilding whenever safe-area padding changes, keyboard visibility shifts, or text scale adjustments occur.</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>enum DeviceType { mobile, tablet, desktop }<br><br>class ResponsiveBreakpoints {<br>  static const double mobileMax = 600;<br>  static const double tabletMax = 1024;<br><br>  static DeviceType getDeviceType(BuildContext context) {<br>    // Optimization: sizeOf ensures rebuilds trigger ONLY on size updates<br>    final double width = MediaQuery.sizeOf(context).width;<br>    <br>    if (width &lt; mobileMax) return DeviceType.mobile;<br>    if (width &lt; tabletMax) return DeviceType.tablet;<br>    return DeviceType.desktop;<br>  }<br>}</pre><h3>3. The Universal Adaptive Scaffold</h3><p>Instead of managing conditional structural logic within individual screen layouts, build a base structural scaffold component. This layout manager handles screen-swapping instantly based on the layout boundaries it receives from the widget tree.</p><pre>class ResponsiveLayout extends StatelessWidget {<br>  final Widget mobileBody;<br>  final Widget? tabletBody; // Optional: falls back to mobile if null<br>  final Widget desktopBody;<br><br>  const ResponsiveLayout({<br>    super.key,<br>    required this.mobileBody,<br>    this.tabletBody,<br>    required this.desktopBody,<br>  });<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return LayoutBuilder(<br>      builder: (context, constraints) {<br>        if (constraints.maxWidth &gt;= ResponsiveBreakpoints.tabletMax) {<br>          return desktopBody;<br>        } else if (constraints.maxWidth &gt;= ResponsiveBreakpoints.mobileMax) {<br>          return tabletBody ?? mobileBody;<br>        } else {<br>          return mobileBody;<br>        }<br>      },<br>    );<br>  }<br>}</pre><p>With this scaffolding in place, rendering a split-pane interface or a multi-column dashboard architecture becomes exceptionally clean. Your top-level page files simply declare the structural variants, keeping your UI presentation layer pristine and readable.</p><h3>4. Component-Level Self-Awareness: A Practical Scenario</h3><p>True responsiveness is granular. A masterfully crafted widget alters its internals dynamically depending on the space allocated to it, completely independent of the global screen size.</p><p>Take a look at this adaptive product card component that seamlessly morphs from a standard horizontal Row to a stacked vertical Column when cramped:</p><pre>class AdaptiveProductCard extends StatelessWidget {<br>  const AdaptiveProductCard({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Card(<br>      elevation: 2,<br>      child: Padding(<br>        padding: const EdgeInsets.all(16.0),<br>        child: LayoutBuilder(<br>          builder: (context, constraints) {<br>            // Check width available specifically to THIS component canvas<br>            final bool isWide = constraints.maxWidth &gt; 420;<br><br>            return Flex(<br>              direction: isWide ? Axis.horizontal : Axis.vertical,<br>              crossAxisAlignment: CrossAxisAlignment.start,<br>              children: [<br>                Container(<br>                  width: isWide ? 120 : double.infinity,<br>                  height: 120,<br>                  color: Colors.grey[200],<br>                  child: const Icon(Icons.shopping_bag_outlined, size: 40),<br>                ),<br>                const SizedBox(width: 16, height: 16),<br>                Expanded(<br>                  flex: isWide ? 1 : 0,<br>                  child: Column(<br>                    crossAxisAlignment: CrossAxisAlignment.start,<br>                    children: [<br>                      Text(<br>                        &#39;Enterprise Feature Architecture&#39;,<br>                        style: Theme.of(context).textTheme.titleMedium?.copyWith(<br>                              fontWeight: FontWeight.bold,<br>                            ),<br>                      ),<br>                      const SizedBox(height: 6),<br>                      Text(<br>                        &#39;Clean architectural guidelines built to scale naturally.&#39;,<br>                        style: Theme.of(context).textTheme.bodyMedium,<br>                      ),<br>                    ],<br>                  ),<br>                ),<br>              ],<br>            );<br>          },<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h3>5. Scaling Multi-Item Grids Professionally</h3><p>Hardcoding a crossAxisCount: 2 into your grid layouts looks excellent on an iPhone, acceptable on an Android tablet, and entirely unreadable on an ultrawide desktop monitor. Senior developers avoid fixed grid column definitions entirely.</p><p>Instead, look to SliverGridDelegateWithMaxCrossAxisExtent. You establish an intentional rule: <em>&quot;No matter how wide this layout canvas gets, each grid card must not exceed a width of 280 pixels.&quot;</em> The Flutter engine evaluates the layout area and calculates the perfect column configuration automatically.</p><pre>GridView.builder(<br>  gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(<br>    maxCrossAxisExtent: 280, <br>    childAspectRatio: 4 / 3,<br>    crossAxisSpacing: 16,<br>    mainAxisSpacing: 16,<br>  ),<br>  itemCount: 12,<br>  itemBuilder: (context, index) =&gt; const AdaptiveProductCard(),<br>);</pre><h3>Final Verdict: Packages vs. Native Vanilla Architecture</h3><p>Many developers instantly load third-party dependencies like flutter_screenutil or responsive_framework. While those are outstanding utilities for targeted scopes, choosing your tools wisely saves you from unnecessary abstraction layers:</p><ul><li><strong>Choose ScreenUtil</strong> if your UI/UX team provides a single, rigid mobile design prototype, and you need to scale the canvas proportionally across diverse phone dimensions without structural layout shifts. <em>Avoid this pattern for multi-platform Web or Desktop systems.</em></li><li><strong>Choose Native Vanilla Architecture</strong> (the rules outlined above) when constructing large-scale, enterprise apps. It ensures zero overhead, total control over structural layout variations, flawless state management hooks (via BLoC or Riverpod), and unmatched rendering efficiency.</li></ul><p>Stop trying to stretch your UI elements onto a screen size. Provide smart, deliberate constraints, build modular adaptive layouts, and let Flutter’s layout engine do what it does best.</p><blockquote>Follow me for more logic-driven architecture insights, optimization guides, and Flutter breakdowns.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb1f876df799" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up iOS Development & Deploy Your Flutter App to the App Store]]></title>
            <link>https://medium.com/@parththinksaloud/how-to-set-up-ios-development-deploy-your-flutter-app-to-the-app-store-89b81c80a9ed?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/89b81c80a9ed</guid>
            <category><![CDATA[profile-setup-ios]]></category>
            <category><![CDATA[flutter-x-apple-account]]></category>
            <category><![CDATA[flutter-release]]></category>
            <category><![CDATA[apple-developer-account]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Mon, 04 May 2026 09:09:55 GMT</pubDate>
            <atom:updated>2026-05-04T09:09:55.330Z</atom:updated>
            <content:encoded><![CDATA[<p>A no-fluff guide to Apple certificates, provisioning profiles, and shipping your first iOS build — from zero to TestFlight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*jSiGOFYhcxQLFIooiKtlXg.png" /></figure><p>If you’ve built a Flutter app and now want to run it on a real iPhone or push it to the App Store, you’ve probably hit the Apple certificate wall. This guide walks you through every step — no skipped details, no assumed knowledge.</p><h3>Part 1 — Apple Developer &amp; App Store Connect Setup</h3><p><strong>Step 1</strong></p><p><strong>Create your App ID (Bundle ID)</strong></p><p>Head to <strong>developer.apple.com → Identifiers → +</strong>. Select <em>App IDs</em>, type <em>App</em>, then enter a name and your bundle ID. This <strong>must exactly match</strong> the bundle ID inside your Flutter project’s ios/Runner.xcodeproj.</p><blockquote><strong>Bundle ID format:</strong> Use reverse-domain notation — e.g.com.yourcompany.appname. Once set, this cannot easily be changed.</blockquote><p><strong>Step 2</strong></p><p><strong>Create an App in App Store Connect</strong></p><p>Go to <strong>appstoreconnect.apple.com → Apps → + → New App</strong>. Fill in the name, select your Bundle ID from the dropdown, and provide a unique SKU (any internal string works).</p><h3>Part 2 — Certificates (The Confusing Part, Simplified)</h3><p>Apple uses two types of certificates for Flutter iOS work:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*nyCbP8ZLbnVamRWA7KQZtw.png" /></figure><p><strong>Step 3</strong></p><p><strong>Create a CSR (Certificate Signing Request) on your Mac</strong></p><p>Open <strong>Keychain Access → Certificate Assistant → Request a Certificate From a Certificate Authority</strong>. Fill your email, select <em>Saved to disk</em>, and save the .certSigningRequest file.</p><p><strong>Step 4</strong></p><p><strong>Create &amp; Download Both Certificates</strong></p><p>In <strong>Apple Developer → Certificates → +, create both a Development and a Distribution certificate</strong> by uploading your CSR each time. Download both .cer files and double-click to install them in Keychain.</p><p><strong>Step 5</strong></p><p><strong>Verify Private Keys in Keychain</strong></p><p>Open <strong>Keychain Access → My Certificates</strong>. Expand each certificate — you must see a private key nested inside. No private key = certificate is unusable. If it’s missing, regenerate using the same Mac.</p><blockquote><strong><em>Common mistake</em></strong></blockquote><blockquote>Downloading a certificate on a different Mac than where the CSR was created will result in no private key. Always create CSR and download on the same machine.</blockquote><h3>Part 3 — Provisioning Profiles</h3><p>A provisioning profile ties together your App ID, certificate, and (for development) specific device UDIDs. You need two:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*5PpFFB_HdE0gLr95KlfLLA.png" /></figure><p><strong>Step 6</strong></p><p><strong>Create Development Profile</strong></p><p><strong>Apple Developer → Profiles → + → iOS App Development</strong>. Choose your App ID, your Development certificate, and add your test device (you’ll need its UDID). Download the .mobileprovision file.</p><p><strong>Step 7</strong></p><p><strong>Create App Store Profile</strong></p><p><strong>Profiles → + → App Store Connect</strong>. Choose your App ID and your Distribution certificate. No device selection needed here. Download the .mobileprovision file.</p><p><strong>Step 8</strong></p><p><strong>Install Both Profiles</strong></p><p>Double-click each downloaded .mobileprovision file. Xcode automatically registers them. You can verify under Xcode → Settings → Accounts → Manage Certificates.</p><h3>Part 4 — Xcode Project Setup</h3><p><strong>Step 9</strong></p><p><strong>Open the iOS project in Xcode</strong></p><p>Always open the workspace file, not the project file:</p><pre># From your Flutter project root<br>open ios/Runner.xcworkspace</pre><p><strong>Step 10</strong></p><p><strong>Add your Apple ID</strong></p><p><strong>Xcode → Settings → Accounts → click + → Add Apple ID</strong>. Sign in with the developer account you used to create certificates.</p><p><strong>Step 11</strong></p><p><strong>Configure Signing</strong></p><p>Select the <strong>Runner</strong> target → <strong>Signing &amp; Capabilities</strong> tab. Set your Team and check <em>Automatically manage signing</em>. Xcode will handle profile selection for you.</p><blockquote><strong>Tip:</strong> If you see “No profiles for your app ID were found” after enabling auto-signing, double-check that the Bundle ID in Xcode matches exactly what you created in the Apple Developer portal.</blockquote><h3>Part 5 — Run on Device &amp; Build for Release</h3><p><strong>Step 12</strong></p><p><strong>Connect your iPhone</strong></p><p>Plug in via cable, tap <em>Trust</em> on your iPhone, and select it as the run target in Xcode. First time pairing may require enabling Developer Mode under iOS Settings → Privacy &amp; Security.</p><pre># Check that Flutter sees your device<br>flutter devices<br><br># Run on the connected iPhone<br>flutter run</pre><p><strong>Step 13</strong></p><p><strong>Build the Release IPA</strong></p><p>Before building for release, always clean and re-fetch packages:</p><pre>flutter clean<br>flutter pub get<br>flutter build ios --release</pre><h3>Part 6 — Archive &amp; Upload to App Store</h3><p><strong>Step 14</strong></p><p><strong>Archive in Xcode</strong></p><p>With your physical device (or <em>Any iOS Device</em>) selected as the target, go to <strong>Product → Archive</strong>. Wait for the build to complete and the Organizer window to appear.</p><p><strong>Step 15</strong></p><p><strong>Distribute to App Store Connect</strong></p><p>In Organizer, select your archive → <strong>Distribute App → App Store Connect → Upload</strong>. Xcode validates and uploads the build. It will appear in TestFlight within minutes to a few hours.</p><h3>Common Errors &amp; Quick Fixes</h3><blockquote><strong>“No certificates available”</strong></blockquote><blockquote>Your certificate is missing its private key in Keychain. Regenerate the CSR on the same Mac and create a fresh certificate.</blockquote><blockquote><strong>“No profiles found”</strong></blockquote><blockquote>The provisioning profile was not created for this App ID, or it wasn’t installed. Double-click the .mobileprovision again.</blockquote><blockquote><strong>Signing error / “Failed to code sign”</strong></blockquote><blockquote>Bundle ID mismatch between Xcode and the Apple Developer portal. Check both and make them identical.</blockquote><blockquote><strong>Device not appearing in flutter devices</strong></blockquote><blockquote>Enable Developer Mode on iOS 16+: Settings → Privacy &amp; Security → Developer Mode. Then trust the computer again.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*CyXkESqFYwOVPJYYQLzwow.png" /></figure><p>Apple’s certificate system feels like bureaucracy at first, but it’s actually just three linked concepts: <strong>who you are</strong> (certificate), <strong>what app</strong> (App ID), and <strong>where it can run</strong> (provisioning profile). Once you see it that way, the portal stops being intimidating. Ship it.</p><p><strong>Happy Coding!</strong> 💙</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89b81c80a9ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Performance: Don’t Let Your App Hog RAM (Space Complexity) ]]></title>
            <link>https://medium.com/@parththinksaloud/flutter-performance-dont-let-your-app-hog-ram-space-complexity-d1c149d85b93?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1c149d85b93</guid>
            <category><![CDATA[space-complexity]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-memory-manage]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 06:16:27 GMT</pubDate>
            <atom:updated>2026-04-21T06:16:27.329Z</atom:updated>
            <content:encoded><![CDATA[<p>In my last post, we talked about how fast code runs (Time Complexity). Today, we’re talking about <strong>Space Complexity</strong>: how much memory (RAM) your algorithm uses.</p><p>In Flutter, memory is precious. If your app uses too much, the Android or iOS system will simply kill it. Here is how to measure your memory footprint like a pro.</p><h4>1. The “Memory Saver”: O(1)</h4><p>This is <strong>Constant Space</strong>. It means your function uses a fixed amount of memory. It doesn’t matter if you are processing 10 items or 10,000; the RAM usage doesn’t move.</p><pre>int sumList(List&lt;int&gt; numbers) {<br>  int total = 0; // Only 1 variable created<br>  for (var n in numbers) {<br>    total += n;<br>  }<br>  return total;<br>}</pre><h4>2. The “New Copy”: O(n)</h4><p>This is <strong>Linear Space</strong>. This usually happens when you take an input list and create a <em>new</em> list or collection from it.</p><p><strong>Example:</strong> Mapping API data to UI Models.</p><pre>List&lt;ProductCard&gt; getCards(List&lt;Product&gt; products) {<br>  // We are creating a brand new list the same size as &#39;products&#39;<br>  return products.map((p) =&gt; ProductCard(product: p)).toList();<br>}</pre><blockquote>If products has 500 items, you just put 500 new objects into memory. That&#39;s O(n).</blockquote><h4>3. The Recursion Trap</h4><p>In Dart/Flutter, every time a function calls itself, it gets added to the <strong>Call Stack</strong>. This takes up memory!</p><pre>int factorial(int n) {<br>  if (n &lt;= 1) return 1;<br>  return n * factorial(n - 1); <br>}</pre><p>Even if you aren’t creating a List, a recursive function that goes n levels deep has a space complexity of <strong>O(n)</strong>. For heavy logic, try using a standard while or for loop to keep it O(1).</p><h3>Why should you care?</h3><p>As Flutter devs, we often choose between speed and memory. For example:</p><ul><li><strong>Searching a List:</strong> O(n) Time, but O(1) Space. (Slow, but light on RAM).</li><li><strong>Using a Map for Search:</strong> O(1) Time, but O(n) Space. (Fast, but uses more RAM).</li></ul><blockquote><strong>The Bottom Line:</strong> Know your data. If you have thousands of items, be careful about creating new lists (O(n)) inside your build methods!</blockquote><p><strong>Happy Coding!</strong> 💙</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1c149d85b93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Beginner’s Guide to Time Complexity ]]></title>
            <link>https://medium.com/@parththinksaloud/a-beginners-guide-to-time-complexity-ef035f36d2f2?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef035f36d2f2</guid>
            <category><![CDATA[time-complexity]]></category>
            <category><![CDATA[flutter-time-complexity]]></category>
            <category><![CDATA[flutter-performance]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 05:01:44 GMT</pubDate>
            <atom:updated>2026-04-02T05:01:44.422Z</atom:updated>
            <content:encoded><![CDATA[<p>As a Flutter developer, I’ve spent a lot of time making UIs smooth. But lately, I’ve realized that smooth animations are only half the battle. If your underlying logic is slow, your app will eventually “jank” — no matter how many const constructors you use.</p><p>Today, let’s break down <strong>Time Complexity</strong> in simple words with practical Dart examples.</p><h3>What is Time Complexity? ⏰</h3><p>Time complexity isn’t about measuring seconds (because a fast PC will always run code quicker than an old phone). Instead, it measures <strong>how the number of operations increases as your data grows.</strong></p><p>In the world of Big O notation, we look for the “Worst Case Scenario.”</p><h3>1. The “Instant” Operation: O(1)</h3><p>This is called <strong>Constant Time</strong>. No matter if your list has 10 items or 10 million, the time taken is always the same.</p><p><strong>Example:</strong> Accessing a list item by its index.</p><pre>String getFirstUser(List&lt;String&gt; users) {<br>  return users[0]; // Always 1 step!<br>}</pre><h3>2. The “Loop” Operation: O(n)</h3><p>This is <strong>Linear Time</strong>. If you double the number of items, the time taken doubles.</p><p><strong>Example:</strong> Searching for a name in an unsorted list.</p><pre>bool containsName(List&lt;String&gt; names, String target) {<br>  for (var name in names) {<br>    if (name == target) return true;<br>  }<br>  return false;<br>}</pre><h3>3. The “Smart” Search: O(log n)</h3><p>This is <strong>Logarithmic Time</strong>. This is where things get interesting. Instead of checking every item, you cut the data in half every time.</p><p><strong>The Binary Search:</strong></p><p>If you have a <strong>sorted</strong> list, you don’t need to check every item. You jump to the middle and see if your target is higher or lower.</p><pre>int binarySearch(List&lt;int&gt; sortedList, int target) {<br>  int low = 0;<br>  int high = sortedList.length - 1;<br><br>  while (low &lt;= high) {<br>    int mid = (low + high) ~/ 2;<br>    if (sortedList[mid] == target) return mid;<br>    <br>    if (sortedList[mid] &gt; target) {<br>      high = mid - 1; // Toss the right half<br>    } else {<br>      low = mid + 1;  // Toss the left half<br>    }<br>  }<br>  return -1;<br>}</pre><blockquote><em>Why it’s awesome:</em> Searching through 1,000,000 items takes only <strong>20 steps</strong>!</blockquote><h3>4. Flutter + Time Complexity: Why it matters 📱</h3><p>In Flutter, we often deal with ListView.builder. While the builder itself is efficient because it only renders what&#39;s on screen, the <strong>logic</strong> we pass to it can be a bottleneck.</p><h3>The Sorting Trap: O(n log n)</h3><p>Imagine you have a list of employees and you want to sort them by salary before displaying them.</p><pre>// Dart&#39;s sort uses an efficient algorithm (O(n log n))<br>employees.sort((a, b) =&gt; a.salary.compareTo(b.salary));<br><br>// Then we display them<br>return ListView.builder(<br>  itemCount: employees.length,<br>  itemBuilder: (context, index) =&gt; UserCard(employees[index]),<br>);</pre><p><strong>The Math:</strong></p><ol><li><strong>Sorting (O(n log n)):</strong> If n=1000, this is roughly 10,000 operations.</li><li><strong>Building (O(n)):</strong> This is 1,000 operations.</li><li><strong>Total:</strong> In Big O, we only keep the “boss” (the dominant term). So, the complexity of this screen logic is <strong>O(n log n)</strong>.</li></ol><blockquote><strong>Pro-Tip:</strong> If your list is massive (e.g., 50,000 items), sorting on every build will cause your UI to freeze. In those cases, move the sorting logic to a compute() function (Isolate) or sort the data once at the API level!</blockquote><h3>Summary</h3><ul><li><strong>O(1):</strong> Perfect.</li><li><strong>O(log n):</strong> Excellent for searching.</li><li><strong>O(n):</strong> Good for simple loops.</li><li><strong>O(n log n):</strong> Standard for sorting.</li><li><strong>O(n²):</strong> Dangerous! (Nested loops).</li></ul><p>Understanding these helps you write Flutter apps that don’t just look good, but perform beautifully as they scale.</p><p><strong>Happy Coding!</strong> 💙</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef035f36d2f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD for Flutter Apps Using GitHub Actions]]></title>
            <link>https://medium.com/@parththinksaloud/ci-cd-for-flutter-apps-using-github-actions-46daee952a46?source=rss-5142df7cd8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/46daee952a46</guid>
            <category><![CDATA[flutter-cicd]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[automate-builds-in-futter]]></category>
            <dc:creator><![CDATA[parththinksaloud]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 07:38:50 GMT</pubDate>
            <atom:updated>2026-04-01T07:38:50.579Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>How I automated my Flutter release builds, ran tests automatically, and generated signed APKs — all without touching Android Studio.</em></blockquote><h3>Why I Wrote This</h3><p>I was tired of the same manual routine every time I had to release a new version of my Flutter attendance app. Open Android Studio. Wait for Gradle. Sign the APK. Download it. Upload it. Repeat.</p><p>One day I thought — <em>what if pushing a git tag was all it took?</em></p><p>That’s exactly what we’re building in this guide. By the end, you will have a complete CI/CD pipeline using GitHub Actions that:</p><p>Runs Flutter tests automatically on every push to main</p><p>Blocks the build if any test fails</p><p>Builds a signed release APK <em>and</em> AAB automatically</p><p>Uploads artifacts — ready to download or push to the Play Store</p><p>No Android Studio. No manual signing. Just two commands.</p><h3>What Is CI/CD?</h3><p><strong>CI — Continuous Integration</strong> means every time you push code, an automated system runs your tests and code checks. If something breaks, you know immediately — before it reaches users.</p><p><strong>CD — Continuous Delivery</strong> means after tests pass, the system automatically builds and delivers your app. In our case: a signed, production-ready APK waiting on GitHub.</p><p>Together, CI/CD removes the human error from your release process.</p><blockquote><strong>In simple terms:</strong> CI is the safety net. CD is the conveyor belt. CI/CD means you can ship confidently, fast, every time.</blockquote><h3>Prerequisites</h3><ul><li>A Flutter project already pushed to GitHub</li><li>A .jks keystore file for signing your release APK</li><li>Your app already configured with signingConfigs in build.gradle</li></ul><blockquote><strong>STEP 1</strong></blockquote><h3>Folder Structure</h3><p>GitHub Actions looks for workflow files in a specific location. Create this structure in your project root:</p><pre>your-flutter-project/<br>  .github/<br>    workflows/<br>      release.yml    ← this is what we&#39;ll create<br>  android/<br>    app/<br>      your-keystore.jks<br>  lib/<br>  test/<br>  pubspec.yaml</pre><blockquote><strong>STEP 2</strong></blockquote><h3>Convert Your Keystore to Base64</h3><p>GitHub Secrets only accept text — you cannot upload binary files. So we convert the .jks file to a base64 string.</p><h3>On Windows (PowerShell):</h3><pre>[Convert]::ToBase64String(<br>  [IO.File]::ReadAllBytes(&quot;android\app\your-keystore.jks&quot;)<br>) | clip</pre><p>This copies the base64 string straight to your clipboard. Open Notepad and paste to verify it worked — you should see a long wall of random characters.</p><h3>On Mac / Linux:</h3><pre>base64 -w 0 android/app/your-keystore.jks</pre><blockquote><strong>STEP 3</strong></blockquote><h3>Add GitHub Secrets</h3><p>Go to your GitHub repository and navigate to <strong>Settings → Secrets and variables → Actions → New repository secret</strong></p><p>Add these four secrets:<br>KEYSTORE_BASE64: The base64 string from Step 2</p><p>KEY_ALIAS: Your key alias (from key.properties)</p><p>KEY_PASSWORD: Your key password</p><p>STORE_PASSWORD: Your keystore password</p><blockquote><strong>Security note:</strong> These secrets are encrypted end-to-end. They are never exposed in build logs, even if your repo is public. GitHub masks them automatically.</blockquote><blockquote><strong>STEP 4</strong></blockquote><h3>Create Your Test Files</h3><p>A CI/CD pipeline without tests is just CD. Let’s add the CI part. Create this structure:</p><pre>test/<br>  unit/<br>    attendance_test.dart<br>  widget/<br>    login_widget_test.dart</pre><h3>test/unit/attendance_test.dart</h3><pre>import &#39;package:flutter_test/flutter_test.dart&#39;;<br><br>void main() {<br>  group(&#39;Attendance Logic Tests&#39;, () {<br><br>    test(&#39;Check-in time should not be null&#39;, () {<br>      final checkInTime = DateTime.now();<br>      expect(checkInTime, isNotNull);<br>    });<br><br>    test(&#39;Employee ID should not be empty&#39;, () {<br>      const employeeId = &#39;EMP001&#39;;<br>      expect(employeeId.isEmpty, false);<br>    });<br><br>    test(&#39;Attendance status defaults to absent&#39;, () {<br>      bool isPresent = false;<br>      expect(isPresent, false);<br>    });<br><br>  });<br>}</pre><h3>test/widget/login_widget_test.dart</h3><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_test/flutter_test.dart&#39;;<br><br>void main() {<br>  group(&#39;Login Widget Tests&#39;, () {<br><br>    testWidgets(&#39;Login screen shows email and password fields&#39;, (tester) async {<br>      await tester.pumpWidget(<br>        const MaterialApp(<br>          home: Scaffold(<br>            body: Column(<br>              children: [<br>                TextField(key: Key(&#39;emailField&#39;)),<br>                TextField(key: Key(&#39;passwordField&#39;)),<br>              ],<br>            ),<br>          ),<br>        ),<br>      );<br>      expect(find.byKey(const Key(&#39;emailField&#39;)), findsOneWidget);<br>      expect(find.byKey(const Key(&#39;passwordField&#39;)), findsOneWidget);<br>    });<br><br>    testWidgets(&#39;Login button exists&#39;, (tester) async {<br>      await tester.pumpWidget(<br>        MaterialApp(<br>          home: Scaffold(<br>            body: ElevatedButton(<br>              key: const Key(&#39;loginButton&#39;),<br>              onPressed: () {},<br>              child: const Text(&#39;Login&#39;),<br>            ),<br>          ),<br>        ),<br>      );<br>      expect(find.byKey(const Key(&#39;loginButton&#39;)), findsOneWidget);<br>    });<br><br>  });<br>}</pre><blockquote><strong>STEP 5</strong></blockquote><h3>The Complete release.yml</h3><p>Create .github/workflows/release.yml and paste the following. I&#39;ll explain every block right after.</p><pre>name: Flutter CI/CD Pipeline<br><br>on:<br>  push:<br>    branches: [ main ]     # CI: runs tests on every push to main<br>    tags:<br>      - &#39;v*&#39;               # CD: builds release on version tags<br>  pull_request:<br>    branches: [ main ]     # CI: runs tests on every pull request<br>  workflow_dispatch:        # allows manual trigger from GitHub UI<br><br>jobs:<br><br>  # ─── JOB 1: TEST (CI) ──────────────────────────────────────<br>  test:<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Checkout code<br>        uses: actions/checkout@v4<br><br>      - name: Setup Flutter<br>        uses: subosito/flutter-action@v2<br>        with:<br>          flutter-version: &#39;3.x&#39;<br>          channel: &#39;stable&#39;<br>          cache: true<br><br>      - name: Get dependencies<br>        run: flutter pub get<br><br>      - name: Analyze code<br>        run: flutter analyze<br><br>      - name: Run unit and widget tests<br>        run: flutter test --coverage<br><br>  # ─── JOB 2: BUILD RELEASE (CD) ─────────────────────────────<br>  build-release-apk:<br>    runs-on: ubuntu-latest<br>    needs: test             # only runs if tests pass<br><br>    steps:<br>      - name: Checkout code<br>        uses: actions/checkout@v4<br><br>      - name: Setup Flutter<br>        uses: subosito/flutter-action@v2<br>        with:<br>          flutter-version: &#39;3.x&#39;<br>          channel: &#39;stable&#39;<br>          cache: true<br><br>      - name: Get dependencies<br>        run: flutter pub get<br><br>      - name: Decode keystore<br>        run: |<br>          echo &quot;${{ secrets.KEYSTORE_BASE64 }}&quot; | base64 --decode \<br>            &gt; android/app/your-keystore.jks<br><br>      - name: Create key.properties<br>        run: |<br>          cat &lt;&lt;EOF &gt; android/key.properties<br>          storePassword=${{ secrets.STORE_PASSWORD }}<br>          keyPassword=${{ secrets.KEY_PASSWORD }}<br>          keyAlias=${{ secrets.KEY_ALIAS }}<br>          storeFile=your-keystore.jks<br>          EOF<br><br>      - name: Build release APK<br>        run: flutter build apk --release<br><br>      - name: Build release AAB<br>        run: flutter build appbundle --release<br><br>      - name: Upload APK artifact<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: release-apk-${{ github.ref_name }}<br>          path: build/app/outputs/flutter-apk/app-release.apk<br>          retention-days: 30<br><br>      - name: Upload AAB artifact<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: release-aab-${{ github.ref_name }}<br>          path: build/app/outputs/bundle/release/app-release.aab<br>          retention-days: 30</pre><blockquote><strong>STEP 6</strong></blockquote><h3>Understanding Every Block</h3><h4>The on: block — Triggers</h4><p>This defines <em>when</em> your workflow runs:</p><ul><li><strong>push → branches: [main]</strong> — Every push to main triggers the test job. This is your CI gate.</li><li><strong>push → tags: [&#39;v*&#39;]</strong> — Pushing a tag like v1.0.3 triggers the full pipeline including the build. This is your CD trigger.</li><li><strong>pull_request → branches: [main]</strong> — Tests run on every PR before code can be merged. Broken code never enters main.</li><li><strong>workflow_dispatch</strong> — Adds a manual &quot;Run workflow&quot; button on the GitHub Actions page. Useful for testing the pipeline without pushing a tag.</li></ul><h4>The test job</h4><ul><li><strong>runs-on: ubuntu-latest</strong> — GitHub provides a free Linux VM. Flutter builds work perfectly here.</li><li><strong>actions/checkout@v4</strong> — Clones your repo onto the runner. Always the first step.</li><li><strong>subosito/flutter-action@v2</strong> — Downloads and installs Flutter SDK. cache: true saves it between runs for speed.</li><li><strong>flutter analyze</strong> — Static analysis. Catches type errors, unused imports, bad patterns before building.</li><li><strong>flutter test --coverage</strong> — Runs everything in your test/ folder. If even one test fails, the pipeline stops here.</li></ul><h4>The build-release-apk job</h4><p>needs: test is the critical line. This job only starts after the test job passes. You will never ship a release build from broken code.</p><p>The <strong>Decode keystore</strong> step converts your base64 secret back into the actual .jks binary file on the runner.</p><p>The <strong>Create key.properties</strong> step dynamically writes the file your build.gradle reads for signing. This file is in .gitignore — CI creates it fresh every run, so passwords never touch your repo.</p><p>github.ref_name in the artifact name automatically adds your tag (like v1.0.3) — so every release artifact is uniquely named.</p><blockquote><strong>STEP 7</strong></blockquote><h3>Trigger Your First Build</h3><h4>Push everything to GitHub:</h4><pre>git add .github/workflows/release.yml<br>git add test/<br>git commit -m &quot;Add CI/CD pipeline with tests&quot;<br>git push origin main</pre><h4>Create a release tag:</h4><pre>git tag v1.0.0<br>git push origin v1.0.0</pre><h4>Watch it run:</h4><p>Go to your GitHub repo → <strong>Actions tab</strong>. You’ll see your pipeline live — first the test job runs, then (if tests pass) the build job starts automatically.</p><p>When it goes green, scroll down on the workflow summary to find the <strong>Artifacts</strong> section. Your signed APK is there, ready to download.</p><h3>The Full Pipeline Flow</h3><pre>Push tag v1.0.x<br>      ↓<br>GitHub Actions triggered<br>      ↓<br>[Job 1 — TEST]<br>  → Checkout code<br>  → Setup Flutter<br>  → flutter pub get<br>  → flutter analyze<br>  → flutter test<br>      ↓<br>Tests fail? ──── Pipeline stops. Build blocked. ✗<br>      ↓<br>Tests pass? ──── Continue ✓<br>      ↓<br>[Job 2 — BUILD]<br>  → Decode keystore from secret<br>  → Create key.properties<br>  → flutter build apk --release<br>  → flutter build appbundle --release<br>  → Upload APK + AAB as artifacts<br>      ↓<br>Download from GitHub Actions page ✓</pre><h3>Common Errors and Fixes</h3><blockquote><strong><em>“Keystore file not found”</em></strong><em><br>Check that the filename in the Decode keystore step matches the </em><em>storeFile= value in key.properties. They must be identical.</em></blockquote><blockquote><strong>“flutter: command not found”</strong><br>The subosito/flutter-action@v2 step must come before any flutter command. Check the step order.</blockquote><blockquote><strong>“Tag already exists”</strong><br>Delete and recreate it:<br>git tag -d v1.0.0 &amp;&amp; git push origin :refs/tags/v1.0.0<br>git tag v1.0.0 &amp;&amp; git push origin v1.0.0</blockquote><blockquote><strong>“Tests fail on CI but pass locally”</strong><br>Usually a missing dependency or a test relying on platform behavior. Run flutter test -v locally to see detailed output.</blockquote><h3>Add to .gitignore</h3><p>Make sure these are in your .gitignore so you never accidentally commit sensitive files:</p><pre>android/key.properties<br>android/app/*.jks</pre><h3>What’s Next</h3><p>This pipeline gives you a solid CI/CD foundation. From here you can extend it:</p><ul><li><strong>Auto-upload to Play Store</strong> using the r0adkll/upload-google-play action</li><li><strong>Slack or email notifications</strong> when a build succeeds or fails</li><li><strong>Code coverage reports</strong> using Coveralls or Codecov</li><li><strong>Integration tests</strong> on a real Android emulator using GitHub’s hosted runners</li></ul><h3>Final Thoughts</h3><p>Setting this up took me an afternoon. Now every release is just two commands:</p><pre>git tag v1.0.x<br>git push origin v1.0.x</pre><p>No more manual signing. No more “I forgot to run tests.” No more building locally and hoping Gradle cooperates. The pipeline handles all of it — every single time.</p><p>If you found this useful, follow me for more Flutter content. Drop a comment if you run into issues — happy to help debug.</p><p>Written by <strong>Parth</strong> · Flutter Developer<br>GitHub: <a href="https://github.com/parthR1910">github.com/parthR1910</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46daee952a46" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>