<?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 Affan Minhas on Medium]]></title>
        <description><![CDATA[Stories by Affan Minhas on Medium]]></description>
        <link>https://medium.com/@affansultan901?source=rss-624198533bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BYGwNsivTN8bBKW4xWmvHg.jpeg</url>
            <title>Stories by Affan Minhas on Medium</title>
            <link>https://medium.com/@affansultan901?source=rss-624198533bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 04:13:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@affansultan901/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[I Built a Finance App for a Market Silicon Valley Doesn’t Model]]></title>
            <link>https://medium.com/@affansultan901/i-built-a-finance-app-for-a-market-silicon-valley-doesnt-model-8c39c9555850?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c39c9555850</guid>
            <category><![CDATA[localization]]></category>
            <category><![CDATA[pakistan]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Wed, 26 Aug 2026 09:15:03 GMT</pubDate>
            <atom:updated>2026-08-26T09:15:03.961Z</atom:updated>
            <content:encoded><![CDATA[<p>Udhaar, kameti and zakat don’t exist in Mint or Splitwise. So I spent ten weeks building a finance app that actually knows how money moves in Pakistan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FdjK357Uq4AwN69P-kacUQ.png" /></figure><p>My mother kept the family accounts in a small notebook.</p><p>Every night before sleeping, the day went into it. Milk, vegetables, the electricity bill. And at the bottom, a line in her handwriting: <em>Falan sahab se 3,000 lene hain</em> — three thousand to collect from so-and-so.</p><p>One day the notebook was gone.</p><p>Nothing catastrophic happened. Nobody went hungry. But an entire month disappeared with it — who owed what, when the kameti payout was due, whether we’d spent more than the month before. She spent weeks trying to reconstruct it from memory, and most of it never came back.</p><p>I’ve been a Flutter developer for four years. I’ve shipped payment integrations, referral systems, apps to the Play Store. And I remember thinking: we build enormous, complicated software, and nobody has built a decent answer to that notebook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDW07GsesaBRpghhkGjpZQ.png" /><figcaption>The actual reason this exists.</figcaption></figure><h3>The Play Store has thousands of expense trackers</h3><p>I know, because I installed a lot of them before writing a single line of code.</p><p>Almost all of them are built for the US or India. And they’re not badly built — Mint, Splitwise, Money Manager, they’re all competent products. They just quietly assume a set of facts about your financial life, and in Pakistan most of those facts are wrong.</p><p>They assume you have a bank account you’d link. They assume “expense” and “income” are the only two directions money travels. They assume you read English comfortably. They assume you’re online.</p><p>None of that describes the person who most needs to track money here.</p><p>The shopkeeper in my neighbourhood keeps meticulous accounts. My mother ran a household budget more complex than most project plans I’ve seen. Neither of them was ever going to open an app whose primary button says <strong>Add Transaction</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xrf_80J_oMDXDLcUtdgDiw.png" /><figcaption>The end of every month, in one question.</figcaption></figure><h3>Three things that have no equivalent in a Western finance app</h3><p>This is the part I underestimated, and it’s the reason I think this piece is worth writing at all.</p><p><strong>Udhaar</strong> is informal lending between people you know. Not a loan — there’s no interest, no contract, no date. You give a friend 5,000. He returns 2,000, then 1,500. Three months pass and neither of you can remember the balance, and asking feels rude. Relationships don’t break over the money. They break because nobody wrote it down.</p><p><strong>Kameti</strong> (also called BC, or a ROSCA in the literature) is a rotating savings pool. Ten or twelve people put in a fixed amount every month, and each month one member takes the entire pot. No bank, no interest, no paperwork — it runs entirely on trust. Roughly every second household in Pakistan is in one. Every kameti generates the same three questions: whose turn is it, who has paid, and when is mine. Those answers usually live inside one person’s head, or on one piece of paper.</p><p><strong>Zakat</strong> is the annual obligatory charitable payment — 2.5% of qualifying wealth above a threshold called nisab. It’s not hard arithmetic. It’s hard bookkeeping, because your wealth is scattered across cash, gold, bank balance, business stock, and money people owe you.</p><p>You cannot translate your way into these. There is no localization file that turns Splitwise into something that understands kameti rotation. The data model itself is different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EEtewxaIFUH72zUKAK0UtA.png" /><figcaption>Kameti tracking. This feature has no counterpart in any international finance app I could find.</figcaption></figure><h3>The interface decision I’d defend hardest</h3><p>The entire app is in Roman Urdu — Urdu written in Latin script, which is how most Pakistanis actually type.</p><p>I got pushback on this. English looks more professional, more fundable, more exportable. But the target user is specifically the person that English-language apps have already failed.</p><p>So income isn’t <strong>Income</strong>. It’s <strong>Aaya</strong> — “came.” Expense isn’t <strong>Expense</strong>. It’s <strong>Gaya</strong> — “went.” Receivables are <strong>Lene hain</strong> — “to be taken.”</p><p>These are the words people already use out loud when they talk about money at home. Nobody has to learn a vocabulary to use the app.</p><p>And where writing itself is the barrier — because plenty of people who keep excellent mental accounts don’t write comfortably — you can speak the entry instead. Say <em>“dhai hazaar khana”</em> and the app parses it into Expense, Rs 2,500, Food. It never commits anything on its own; you confirm every entry. And the parsing runs on-device, because a recording of someone saying what they spent money on has no business leaving their phone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A8W3uPcLVL0eAPmfkWcObw.png" /><figcaption>Aaya. Gaya. Lene hain. The words people already use.</figcaption></figure><h3>No account, no login, no internet</h3><p>This was an architectural decision before it was a marketing one.</p><p>HisaabYaar has no sign-up. You open it and start writing. There’s no phone number collection, no contacts permission, no email. Data is stored locally with AES-256 encryption. Cloud backup exists but ships off — if you never enable it, nothing ever leaves the device.</p><p>Every feature works fully offline. Not degraded-offline, where it queues writes and syncs later. Offline as the normal operating mode, with sync as the optional extra.</p><p>Partly this is honest engineering for the market. Connectivity here is inconsistent and mobile data is a real budget line. An app that stalls on a spinner in a shop with two bars of signal is an app that gets uninstalled.</p><p>But mostly it’s about trust. Financial records are the most private thing on a person’s phone. Pakistani users have watched free apps harvest contacts and sell data, and they’re right to be suspicious. The strongest privacy claim you can make isn’t a policy page — it’s an architecture where you never held the data in the first place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Me_652sWXZfmataHtTHftA.png" /><figcaption>The privacy model, stated plainly.</figcaption></figure><h3>The feature I’m proudest of also knows when to shut up</h3><p>Every expense tracker tells you what already happened. Correct, and useless — by the time the report arrives, the money is spent.</p><p>The question people actually have is: <strong>when does the money run out?</strong></p><p>Learning that on the 12th and learning it on the 20th are two different lives. On the 12th you adjust. On the 20th your options are pulling your kameti early or borrowing at interest, and both are expensive.</p><p>So HisaabYaar projects a runway. It reads your last three months of real daily spend, layers in known fixed costs — rent, bills, your kameti turn — and says: <em>at this rate, the money lasts until the 18th.</em></p><p>The design decision underneath that: it uses the <strong>median</strong> daily spend, not the mean. One wedding or one big repair shouldn’t distort the whole forecast.</p><p>And when there isn’t enough history to project honestly, it says nothing at all. No confident-looking number derived from eleven days of data. In a finance app, a wrong prediction is worse than no prediction — someone might plan around it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i9nkcNf5ggpUGlbxhLOvOA.png" /><figcaption>Most apps report the past. This one tries to warn you about the future — and stays quiet when it can’t.</figcaption></figure><h3>A note for the freelancers reading this</h3><p>Since a lot of Medium’s Pakistani readership freelances, this part may be directly useful.</p><p>Freelance money doesn’t behave like salary. You earn in dollars and spend in rupees. It lands in Payoneer or Wise before it reaches your bank. Every gateway takes a different cut at a different rate. Clients pay late. And the tax treatment is completely different from salaried slabs — software export income is taxed at <strong>0.25%</strong> if you’re PSEB-registered and <strong>1%</strong> if you’re not.</p><p>A lot of freelancers don’t know that and overpay.</p><p>So there’s a dedicated mode: log only what actually landed in your PKR account, since that’s what’s taxable. Tax calculates automatically, with a PSEB toggle so you can see the difference. Everything reports on the July–June fiscal year the FBR actually uses. It tracks which gateway is giving you the best effective rate, and which clients pay late. And it generates branded PDF invoices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xds_kvSoliWIoFqNdI9cGQ.png" /><figcaption>0.25% with PSEB registration, 1% without. Worth knowing.</figcaption></figure><h3>Built in Flutter, by one person, in about ten weeks</h3><p>First commit was 17 June. The stack is deliberately unremarkable.</p><p>Flutter, because one codebase is the only way a solo developer maintains two platforms. Local-first persistence with encryption at rest, since the network isn’t in the critical path for anything. Clean architecture with a real repository layer — “MVP” is not a licence to write code you can’t extend in month four. On-device processing for voice parsing and bill OCR, which is a privacy decision that happens to also be an offline decision.</p><p>No funding, no team, no company. Nights and a stubborn conviction that Pakistan deserved something built for it rather than translated at it.</p><p>I’m not saying that for applause. I’m saying it because when you hit a bug, you should know you’re talking to the person who wrote the code — not a ticket queue.</p><h3>It’s live</h3><p>HisaabYaar is on Google Play. Free — genuinely free, not trial-free. Personal finance stays free permanently: income, expenses, udhaar, kameti, zakat, budgets, reports. Business features for shopkeepers will be paid later, because that’s a tool people earn money with. Household budgeting isn’t a luxury good and shouldn’t be priced like one.</p><p>Export is always available, in CSV and PDF, forever. Your records never get locked inside my app.</p><p>📥 <strong>Download:</strong> <a href="https://play.google.com/store/apps/details?id=pk.hisaabyaar.hisaabyaar">https://play.google.com/store/apps/details?id=pk.hisaabyaar.hisaabyaar</a> 🌐 <strong>hisaabyaar.pk</strong></p><p>If you build products for markets outside the US and Europe, I’d genuinely like to hear what you found untranslatable. That was the most interesting problem in this entire project, and I suspect every market has its own version of kameti.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1hukPXFbUZUIyiGk_zc7Cw.png" /></figure><p>Follow me for more:</p><figure><img alt="https://www.linkedin.com/in/affan-minhas/" src="https://cdn-images-1.medium.com/max/1024/0*CxZ0gf_BhMcRfk2k.png" /><figcaption><a href="https://www.linkedin.com/in/affan-minhas/">https://www.linkedin.com/in/affan-minhas/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c39c9555850" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Bank Already Told Your Phone. Why Are You Typing It Again?]]></title>
            <link>https://medium.com/@affansultan901/your-bank-already-told-your-phone-why-are-you-typing-it-again-9481da429a59?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/9481da429a59</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Wed, 26 Aug 2026 05:40:21 GMT</pubDate>
            <atom:updated>2026-09-26T08:43:03.092Z</atom:updated>
            <content:encoded><![CDATA[<p>How I made Hisaab Yaar read bank notifications on Android and turn them into one-tap expense entries — Flutter + Kotlin, 2026</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pwYNe558OiW0bgHoG-rg0w.png" /></figure><p>Some live examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ify368zF1qZuFO5Kickzew.png" /></figure><p>💡 <em>Every expense tracker dies the same death.</em> Not from bad UI, not from missing features — from the fifth day, when the user pays for something, thinks “I’ll add it later,” and never does.</p><p>I’ve built a few of these now. The retention graph always looks the same: a cliff at day four. And the reason is boring. Logging an expense costs about twenty seconds of typing for a transaction your phone <em>already knows about</em>. Your bank pushed a notification with the amount, the merchant, the account and the reference number. Then the app asks you to type all of it again.</p><p>So while building <strong>Hisaab Yaar</strong>, I stopped trying to make the “Add Expense” screen faster and started trying to delete it.</p><p>In this guide I’ll walk you through <strong>the full notification-capture pipeline I shipped</strong>: the Kotlin NotificationListenerService, the bridge that wakes Dart when your app is dead, a bank-rule parser that doesn&#39;t collapse the moment a bank changes its wording, confidence scoring, deduplication, and the notification that turns a payment into a ledger entry with one tap.</p><p>By the end, you’ll be able to:</p><ul><li>Read notifications from specific apps on Android from Flutter</li><li>Wake a Dart isolate from a native service when your app isn’t running</li><li>Parse messy bank alerts into structured transactions without hardcoding one giant regex</li><li>Decide when to ask the user and when to just save it</li><li>Get through Play Store review without a rejection email</li></ul><p>One honest warning before we start: <strong>this is Android-only, and it always will be.</strong> I’ll cover why, and what’s left for iOS, near the end.</p><p>Let’s dive in 😃</p><h3>The shape of the thing</h3><p>Before any code, here’s the whole pipeline. Seven stages, two of which have to run in Kotlin because Dart simply isn’t awake when the notification arrives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-UfMFASrYy2UUIbskx0nQ.png" /><figcaption>The seven stages. Only stages 2 and 3 need native code — everything after that is ordinary Flutter you can unit-test on your laptop.</figcaption></figure><p>The design principle that matters most: <strong>nothing is thrown away silently.</strong> Every candidate gets written to a local database before anything is displayed. If the parser fails, the raw text sits in a review inbox instead of vanishing. That one decision saved me weeks of “the app missed my payment and I have no idea why.”</p><h3>Reality check: what Android will actually let you do</h3><p>There are three ways to see a payment on Android, and only one of them still works properly in 2026.</p><p><strong>Reading SMS.</strong> READ_SMS is a restricted permission. Google will approve it for a default SMS handler or an app whose core purpose is SMS backup. An expense tracker is neither. You will be rejected, and the rejection is slow.</p><p><strong>Open banking APIs.</strong> Fine if you’re in a market with real aggregators. In Pakistan, for a solo developer, the answer is no.</p><p><strong>Notification access.</strong> NotificationListenerService lets you read every notification posted on the device. It&#39;s granted from a special settings screen, not a runtime dialog, and Google treats it as restricted — but &quot;apps that aggregate notifications&quot; is an explicitly permitted use case, and reading a bank alert to help someone track their own spending sits squarely inside it, <em>provided you disclose it properly and keep the data on the device.</em></p><p>That last clause isn’t legal boilerplate. It’s a design constraint that shapes the whole architecture, and I’ll come back to it.</p><h3>Step 1: The manifest</h3><p>Start here, because this is where most tutorials get it wrong.</p><pre>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;<br><br>    &lt;uses-permission android:name=&quot;android.permission.POST_NOTIFICATIONS&quot; /&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; /&gt;<br><br>    &lt;application<br>        android:name=&quot;${applicationName}&quot;<br>        android:label=&quot;Hisaab Yaar&quot;&gt;<br><br>        &lt;service<br>            android:name=&quot;.capture.HisaabNotificationListener&quot;<br>            android:label=&quot;Hisaab Yaar capture&quot;<br>            android:exported=&quot;true&quot;<br>            android:permission=&quot;android.permission.BIND_NOTIFICATION_LISTENER_SERVICE&quot;&gt;<br>            &lt;intent-filter&gt;<br>                &lt;action android:name=&quot;android.service.notification.NotificationListenerService&quot; /&gt;<br>            &lt;/intent-filter&gt;<br>        &lt;/service&gt;<br><br>    &lt;/application&gt;<br>&lt;/manifest&gt;</pre><p>Notice what is <strong>not</strong> there:</p><pre>&lt;!-- ❌ Do NOT do this. It does nothing. --&gt;<br>&lt;uses-permission android:name=&quot;android.permission.BIND_NOTIFICATION_LISTENER_SERVICE&quot; /&gt;</pre><p>BIND_NOTIFICATION_LISTENER_SERVICE is a signature-level permission held by <em>the system</em>, not by you. You declare it with android:permission on the &lt;service&gt; tag, which is your way of saying &quot;only the system may bind to this.&quot; Adding it as a &lt;uses-permission&gt; is a no-op that a hundred Stack Overflow answers will still tell you to do. 🙃</p><h3>Step 2: The listener</h3><p>This is the only piece of the system that runs on every single notification on the device, so it has to be ruthless and fast. It runs on the main thread of a system-bound service. If you spend 200ms in here, the user’s phone stutters.</p><pre>package com.hisaabyaar.app.capture<br><br>import android.app.Notification<br>import android.service.notification.NotificationListenerService<br>import android.service.notification.StatusBarNotification<br>import java.security.MessageDigest<br><br>class HisaabNotificationListener : NotificationListenerService() {<br><br>    companion object {<br>        /**<br>         * The whitelist. Nothing outside this set is ever read — we return<br>         * before touching the extras bundle, so the text of your WhatsApp<br>         * messages is never even loaded into memory.<br>         */<br>        val watched = setOf(<br>            &quot;com.hbl.mobile&quot;,<br>            &quot;pk.com.meezanbank.mobile&quot;,<br>            &quot;com.sadapay.app&quot;,<br>            &quot;com.techlogix.mobilinkcustomer&quot;,    // JazzCash<br>            &quot;com.google.android.apps.messaging&quot;  // banks that only send SMS<br>        )<br><br>        /** Bounded LRU of fingerprints we&#39;ve already forwarded. */<br>        private val recent = object : LinkedHashMap&lt;String, Long&gt;(64, 0.75f, true) {<br>            override fun removeEldestEntry(eldest: Map.Entry&lt;String, Long&gt;?) = size &gt; 200<br>        }<br>    }<br><br>    override fun onNotificationPosted(sbn: StatusBarNotification) {<br>        val pkg = sbn.packageName<br>        if (pkg !in watched) return<br><br>        // Ongoing = media players, downloads, sync bars. Never a payment.<br>        if (sbn.isOngoing) return<br><br>        // Group summaries repeat the text of their children.<br>        if (sbn.notification.flags and Notification.FLAG_GROUP_SUMMARY != 0) return<br><br>        val extras = sbn.notification.extras<br>        val title = extras.getCharSequence(Notification.EXTRA_TITLE)?.toString().orEmpty()<br><br>        // BIG_TEXT first — EXTRA_TEXT is the collapsed, truncated version and<br>        // the reference number is usually the part that gets cut off.<br>        val text = extras.getCharSequence(Notification.EXTRA_BIG_TEXT)?.toString()<br>            ?: extras.getCharSequence(Notification.EXTRA_TEXT)?.toString().orEmpty()<br><br>        if (text.isBlank()) return<br><br>        val fingerprint = sha256(&quot;$pkg|${text.trim()}|${sbn.postTime / 60_000}&quot;)<br>        synchronized(recent) {<br>            if (recent.containsKey(fingerprint)) return<br>            recent[fingerprint] = System.currentTimeMillis()<br>        }<br><br>        NotificationBridge.dispatch(<br>            applicationContext,<br>            CapturedNotification(<br>                packageName = pkg,<br>                title = title,<br>                text = text,<br>                postedAt = sbn.postTime,<br>                fingerprint = fingerprint<br>            )<br>        )<br>    }<br><br>    private fun sha256(input: String): String =<br>        MessageDigest.getInstance(&quot;SHA-256&quot;)<br>            .digest(input.toByteArray())<br>            .joinToString(&quot;&quot;) { &quot;%02x&quot;.format(it) }<br>}</pre><p>And the payload, kept deliberately dumb:</p><pre>package com.hisaabyaar.app.capture<br><br>data class CapturedNotification(<br>    val packageName: String,<br>    val title: String,<br>    val text: String,<br>    val postedAt: Long,<br>    val fingerprint: String<br>) {<br>    fun toMap(): Map&lt;String, Any&gt; = mapOf(<br>        &quot;packageName&quot; to packageName,<br>        &quot;title&quot; to title,<br>        &quot;text&quot; to text,<br>        &quot;postedAt&quot; to postedAt,<br>        &quot;fingerprint&quot; to fingerprint<br>    )<br>}</pre><p>Three things in that listener are load-bearing, and I learned each one the hard way:</p><ul><li><strong>EXTRA_BIG_TEXT before </strong><strong>EXTRA_TEXT.</strong> The collapsed notification is truncated with an ellipsis, and banks put the reference number at the end. I spent an evening convinced HBL had stopped sending reference numbers.</li><li><strong>FLAG_GROUP_SUMMARY.</strong> When two payments land close together, Android posts a third summary notification containing both. Without this check, you log a phantom transaction.</li><li><strong>The whitelist runs before anything else.</strong> Not for performance — for the privacy claim you’re about to make on your Play listing. You want to be able to say honestly that non-whitelisted notification text is never read, and you want that to be true at the line level.</li></ul><h3>Step 3: Waking Dart when your app is dead</h3><p>Here’s the awkward part. onNotificationPosted fires whether or not your app is running. Most of the time it isn&#39;t. So the bridge has two completely different paths:</p><ul><li><strong>App in the foreground</strong> → push it down an EventChannel, done.</li><li><strong>App killed</strong> → boot a headless FlutterEngine, run a registered Dart entrypoint, and deliver through a MethodChannel.</li></ul><pre>package com.hisaabyaar.app.capture<br><br>import android.content.Context<br>import android.os.Handler<br>import android.os.Looper<br>import io.flutter.FlutterInjector<br>import io.flutter.embedding.engine.FlutterEngine<br>import io.flutter.embedding.engine.dart.DartExecutor<br>import io.flutter.plugin.common.BinaryMessenger<br>import io.flutter.plugin.common.EventChannel<br>import io.flutter.plugin.common.MethodChannel<br>import io.flutter.view.FlutterCallbackInformation<br><br>object NotificationBridge {<br><br>    private const val EVENTS = &quot;hisaabyaar/capture/events&quot;<br>    private const val BACKGROUND = &quot;hisaabyaar/capture/background&quot;<br>    private const val PREFS = &quot;hisaab_capture&quot;<br>    private const val KEY_HANDLE = &quot;bg_callback_handle&quot;<br><br>    private var sink: EventChannel.EventSink? = null<br>    private var bgEngine: FlutterEngine? = null<br>    private var bgChannel: MethodChannel? = null<br>    private var bgReady = false<br>    private val pending = mutableListOf&lt;CapturedNotification&gt;()<br><br>    /** Called from MainActivity while the UI is alive. */<br>    fun attach(messenger: BinaryMessenger) {<br>        EventChannel(messenger, EVENTS).setStreamHandler(<br>            object : EventChannel.StreamHandler {<br>                override fun onListen(args: Any?, events: EventChannel.EventSink?) {<br>                    sink = events<br>                }<br>                override fun onCancel(args: Any?) {<br>                    sink = null<br>                }<br>            }<br>        )<br>    }<br><br>    fun saveHandle(context: Context, handle: Long) {<br>        context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)<br>            .edit().putLong(KEY_HANDLE, handle).apply()<br>    }<br><br>    fun dispatch(context: Context, notification: CapturedNotification) {<br>        Handler(Looper.getMainLooper()).post {<br>            val live = sink<br>            if (live != null) {<br>                live.success(notification.toMap())<br>            } else {<br>                deliverHeadless(context, notification)<br>            }<br>        }<br>    }<br><br>    private fun deliverHeadless(context: Context, notification: CapturedNotification) {<br>        pending += notification<br><br>        if (bgReady) return drain()<br>        if (bgEngine != null) return          // still booting; drain() will catch up<br><br>        val handle = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)<br>            .getLong(KEY_HANDLE, 0L)<br>        if (handle == 0L) return              // Dart never registered — nothing to do<br><br>        val callback = FlutterCallbackInformation.lookupCallbackInformation(handle) ?: return<br><br>        val loader = FlutterInjector.instance().flutterLoader()<br>        loader.startInitialization(context)<br>        loader.ensureInitializationComplete(context, null)<br><br>        val engine = FlutterEngine(context)<br>        bgChannel = MethodChannel(engine.dartExecutor.binaryMessenger, BACKGROUND).apply {<br>            setMethodCallHandler { call, result -&gt;<br>                if (call.method == &quot;ready&quot;) {<br>                    bgReady = true<br>                    drain()<br>                    result.success(null)<br>                } else {<br>                    result.notImplemented()<br>                }<br>            }<br>        }<br><br>        engine.dartExecutor.executeDartCallback(<br>            DartExecutor.DartCallback(context.assets, loader.findAppBundlePath(), callback)<br>        )<br>        bgEngine = engine<br>    }<br><br>    private fun drain() {<br>        val channel = bgChannel ?: return<br>        val batch = pending.toList()<br>        pending.clear()<br>        batch.forEach { channel.invokeMethod(&quot;onNotification&quot;, it.toMap()) }<br>    }<br>}</pre><p>The queue matters. Booting a FlutterEngine takes a few hundred milliseconds, and notifications can arrive during that window. Without pending, the first payment after a cold start silently disappears — which is exactly the payment the user is watching for when they test your feature. 😅</p><p>And the wiring in MainActivity:</p><pre>package com.hisaabyaar.app<br><br>import android.content.Intent<br>import android.provider.Settings<br>import androidx.core.app.NotificationManagerCompat<br>import com.hisaabyaar.app.capture.NotificationBridge<br>import io.flutter.embedding.android.FlutterActivity<br>import io.flutter.embedding.engine.FlutterEngine<br>import io.flutter.plugin.common.MethodChannel<br><br>class MainActivity : FlutterActivity() {<br><br>    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {<br>        super.configureFlutterEngine(flutterEngine)<br>        val messenger = flutterEngine.dartExecutor.binaryMessenger<br><br>        NotificationBridge.attach(messenger)<br><br>        MethodChannel(messenger, &quot;hisaabyaar/capture/control&quot;).setMethodCallHandler { call, result -&gt;<br>            when (call.method) {<br>                &quot;isGranted&quot; -&gt; result.success(<br>                    NotificationManagerCompat.getEnabledListenerPackages(this)<br>                        .contains(packageName)<br>                )<br>                &quot;openSettings&quot; -&gt; {<br>                    startActivity(Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS))<br>                    result.success(null)<br>                }<br>                &quot;registerBackgroundHandler&quot; -&gt; {<br>                    NotificationBridge.saveHandle(this, call.arguments as Long)<br>                    result.success(null)<br>                }<br>                else -&gt; result.notImplemented()<br>            }<br>        }<br>    }<br>}</pre><p>NotificationManagerCompat.getEnabledListenerPackages() is the correct way to check the permission in 2026. Older articles will show you a Settings.Secure.getString(..., &quot;enabled_notification_listeners&quot;) string-parsing hack. It still works, and it&#39;s still awful.</p><h3>The Dart side of the bridge</h3><pre>// lib/capture/capture_channel.dart<br>import &#39;dart:ui&#39;;<br>import &#39;package:flutter/services.dart&#39;;<br>import &#39;package:flutter/widgets.dart&#39;;<br><br>import &#39;capture_pipeline.dart&#39;;<br>import &#39;captured_notification.dart&#39;;<br><br>class CaptureChannel {<br>  static const _control = MethodChannel(&#39;hisaabyaar/capture/control&#39;);<br>  static const _events = EventChannel(&#39;hisaabyaar/capture/events&#39;);<br><br>  static Future&lt;bool&gt; isGranted() async =&gt;<br>      await _control.invokeMethod&lt;bool&gt;(&#39;isGranted&#39;) ?? false;<br><br>  static Future&lt;void&gt; openSettings() =&gt; _control.invokeMethod(&#39;openSettings&#39;);<br><br>  static Stream&lt;CapturedNotification&gt; watch() =&gt; _events<br>      .receiveBroadcastStream()<br>      .map((e) =&gt; CapturedNotification.fromMap(Map&lt;String, dynamic&gt;.from(e as Map)));<br><br>  /// Call once at startup. Tells the native side which Dart function to run<br>  /// when it needs to wake us up with no UI attached.<br>  static Future&lt;void&gt; registerBackgroundHandler() async {<br>    final handle = PluginUtilities.getCallbackHandle(captureEntrypoint);<br>    if (handle == null) return;<br>    await _control.invokeMethod(&#39;registerBackgroundHandler&#39;, handle.toRawHandle());<br>  }<br>}<br><br>@pragma(&#39;vm:entry-point&#39;)<br>Future&lt;void&gt; captureEntrypoint() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br><br>  const background = MethodChannel(&#39;hisaabyaar/capture/background&#39;);<br>  background.setMethodCallHandler((call) async {<br>    if (call.method != &#39;onNotification&#39;) return;<br>    final captured =<br>        CapturedNotification.fromMap(Map&lt;String, dynamic&gt;.from(call.arguments as Map));<br>    await CapturePipeline.instance.handle(captured);<br>  });<br><br>  await background.invokeMethod(&#39;ready&#39;);<br>}</pre><p><strong>@pragma(&#39;vm:entry-point&#39;) is not optional.</strong> In release builds, tree-shaking removes any function that nothing appears to call, and from Dart&#39;s point of view nothing calls this one. Everything works perfectly in debug, then your feature is dead in the Play build. This costs everyone a day exactly once.</p><p>Also note: this isolate has <strong>no shared state with your UI isolate</strong>. Your Riverpod providers, your GetIt singletons, your open database handle — none of it exists here. Everything the background path needs, it must open for itself.</p><pre>// lib/capture/capture_foreground_binding.dart<br>class CaptureForegroundBinding {<br>  CaptureForegroundBinding._();<br>  static final instance = CaptureForegroundBinding._();<br><br>  StreamSubscription&lt;CapturedNotification&gt;? _sub;<br><br>  void start() {<br>    _sub ??= CaptureChannel.watch().listen(<br>      (captured) =&gt; CapturePipeline.instance.handle(captured),<br>      onError: (e, st) =&gt; debugPrint(&#39;capture stream error: $e&#39;),<br>    );<br>  }<br><br>  Future&lt;void&gt; stop() async {<br>    await _sub?.cancel();<br>    _sub = null;<br>  }<br>}</pre><p>Called once after the permission check, alongside registerBackgroundHandler():</p><pre>if (await CaptureChannel.isGranted()) {<br>  await CaptureChannel.registerBackgroundHandler();<br>  CaptureForegroundBinding.instance.start();<br>}</pre><h3>Step 4: Look at what you’re actually parsing</h3><p>Now the fun part. Here’s a real HBL alert, taken apart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_an7o8cnYRwiERu221hf_g.png" /><figcaption>Every field an expense row needs is already in the sentence. The job is extraction, not entry.</figcaption></figure><p>Look at the bottom of that image again — the same payment, four banks, four completely different sentences. Some give you a reference number, some don’t. Some uppercase the merchant, some don’t. SadaPay writes in plain English; HBL writes like a mainframe.</p><p>This is why the naive approach fails. You write one beautiful regex against HBL’s format, ship it, and three weeks later a Meezan user opens it, and nothing is ever caught. Then HBL updates their app, changes “has been debited” to “was debited,” and you break the one bank that worked.</p><p>So: <strong>one rule set per bank, keyed on package name, with no global fallback.</strong></p><h3>Step 5: The bank rule registry</h3><pre>// lib/capture/bank_rules.dart<br><br>enum Direction { debit, credit }<br><br>class BankRule {<br>  const BankRule({<br>    required this.id,<br>    required this.label,<br>    required this.packages,<br>    required this.amount,<br>    required this.debitWords,<br>    required this.creditWords,<br>    this.counterparty,<br>    this.accountTail,<br>    this.reference,<br>    this.ignore = const [],<br>  });<br><br>  final String id;<br>  final String label;<br>  final Set&lt;String&gt; packages;<br><br>  /// Must expose the numeric amount as group 1.<br>  final RegExp amount;<br><br>  final Set&lt;String&gt; debitWords;<br>  final Set&lt;String&gt; creditWords;<br><br>  final RegExp? counterparty;<br>  final RegExp? accountTail;<br>  final RegExp? reference;<br><br>  /// If any of these hit, the notification is not a transaction. OTPs,<br>  /// marketing pushes, &quot;your statement is ready&quot; — all noise.<br>  final List&lt;RegExp&gt; ignore;<br>}<br><br>/// &quot;PKR 4,500.00&quot; / &quot;Rs. 4,500&quot; / &quot;Rs4500.00&quot;<br>final _rupees = RegExp(<br>  r&#39;(?:pkr|rs\.?)\s*([0-9][0-9,]*(?:\.[0-9]{1,2})?)&#39;,<br>  caseSensitive: false,<br>);<br><br>final _noise = &lt;RegExp&gt;[<br>  RegExp(r&#39;\botp\b|one[\s-]?time\s?(?:password|pin)|do not share&#39;, caseSensitive: false),<br>  RegExp(r&#39;statement is ready|e-?statement|has been generated&#39;, caseSensitive: false),<br>  RegExp(r&#39;\bcashback\b.*\boffer\b|limited time|avail now&#39;, caseSensitive: false),<br>];<br><br>final bankRules = &lt;BankRule&gt;[<br>  BankRule(<br>    id: &#39;hbl&#39;,<br>    label: &#39;HBL&#39;,<br>    packages: const {&#39;com.hbl.mobile&#39;},<br>    amount: _rupees,<br>    debitWords: const {&#39;debited&#39;, &#39;debit alert&#39;, &#39;withdrawn&#39;, &#39;transferred to&#39;},<br>    creditWords: const {&#39;credited&#39;, &#39;credit alert&#39;, &#39;received from&#39;},<br>    accountTail: RegExp(r&#39;(?:a/?c|acct|account)[^0-9]{0,12}(\d{4})\b&#39;, caseSensitive: false),<br>    counterparty: RegExp(r&#39;\b(?:to|from)\s+([A-Z][A-Z0-9 &amp;.\-]{2,40})&#39;),<br>    reference: RegExp(r&#39;(?:ref#?|trx#?|tid)[^0-9a-zA-Z]{0,4}([A-Za-z0-9]{6,20})&#39;,<br>        caseSensitive: false),<br>    ignore: _noise,<br>  ),<br>  BankRule(<br>    id: &#39;meezan&#39;,<br>    label: &#39;Meezan Bank&#39;,<br>    packages: const {&#39;pk.com.meezanbank.mobile&#39;},<br>    amount: _rupees,<br>    debitWords: const {&#39;debited&#39;, &#39;paid&#39;, &#39;sent&#39;},<br>    creditWords: const {&#39;credited&#39;, &#39;received&#39;},<br>    accountTail: RegExp(r&#39;a/?c\s*\.{0,3}\s*(\d{4})\b&#39;, caseSensitive: false),<br>    counterparty: RegExp(r&#39;\|\s*([A-Za-z][A-Za-z0-9 &amp;.\-]{2,40})\s*\|&#39;),<br>    reference: RegExp(r&#39;\b(?:ref|trn)[^0-9a-zA-Z]{0,4}([A-Za-z0-9]{6,20})&#39;, caseSensitive: false),<br>    ignore: _noise,<br>  ),<br>  BankRule(<br>    id: &#39;sadapay&#39;,<br>    label: &#39;SadaPay&#39;,<br>    packages: const {&#39;com.sadapay.app&#39;},<br>    amount: _rupees,<br>    debitWords: const {&#39;you sent&#39;, &#39;you paid&#39;, &#39;spent&#39;},<br>    creditWords: const {&#39;you received&#39;, &#39;added to your&#39;},<br>    counterparty: RegExp(r&#39;\b(?:to|from)\s+([A-Za-z][A-Za-z0-9 &amp;.\-]{2,40})&#39;),<br>    ignore: _noise,<br>  ),<br>];</pre><p>Adding a bank is now a data change, not a code change. When a user sends me a screenshot of an alert my app missed, the fix is usually four lines and a test — not a refactor.</p><h3>Step 6: The parser</h3><p>Six small passes. Each one is boring on its own, and that’s the point: every one of them is trivially unit-testable without a phone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0lcpdQCjSwMgjXEPNAf_w.png" /><figcaption>Six passes over one string. No step is clever, so no step is hard to debug.</figcaption></figure><pre>// lib/capture/transaction_parser.dart<br>import &#39;package:collection/collection.dart&#39;;<br><br>import &#39;bank_rules.dart&#39;;<br>import &#39;captured_notification.dart&#39;;<br>import &#39;parsed_transaction.dart&#39;;<br><br>class TransactionParser {<br>  const TransactionParser(this.rules);<br>  final List&lt;BankRule&gt; rules;<br><br>  ParsedTransaction? parse(CapturedNotification n) {<br>    final rule = rules.firstWhereOrNull((r) =&gt; r.packages.contains(n.packageName));<br>    if (rule == null) return null;<br><br>    final raw = &#39;${n.title}. ${n.text}&#39;;<br>    final text = _normalise(raw);<br><br>    if (rule.ignore.any((p) =&gt; p.hasMatch(text))) return null;<br><br>    // --- the two non-negotiables -------------------------------------<br>    final amountMatch = rule.amount.firstMatch(text);<br>    if (amountMatch == null) return null;<br><br>    final amountMinor = _toMinor(amountMatch.group(1)!);<br>    if (amountMinor &lt;= 0 || amountMinor &gt; 100000000000) return null; // 1 billion rupees, no<br><br>    final direction = _direction(text, rule);<br>    if (direction == null) return null;<br><br>    var confidence = 0.60; // amount 0.40 + direction 0.20<br><br>    // --- the nice-to-haves -------------------------------------------<br>    // counterparty is matched against the ORIGINAL text: casing is signal.<br>    final party = rule.counterparty?.firstMatch(raw)?.group(1)?.trim();<br>    if (party != null &amp;&amp; party.length &gt; 2) confidence += 0.15;<br><br>    final reference = rule.reference?.firstMatch(text)?.group(1);<br>    if (reference != null) confidence += 0.15;<br><br>    final tail = rule.accountTail?.firstMatch(text)?.group(1);<br>    if (tail != null) confidence += 0.10;<br><br>    return ParsedTransaction(<br>      bankId: rule.id,<br>      fingerprint: n.fingerprint,<br>      amountMinor: amountMinor,<br>      currency: &#39;PKR&#39;,<br>      direction: direction,<br>      counterparty: party,<br>      accountTail: tail,<br>      reference: reference,<br>      occurredAt: DateTime.fromMillisecondsSinceEpoch(n.postedAt),<br>      confidence: confidence.clamp(0.0, 1.0),<br>    );<br>  }<br><br>  String _normalise(String input) =&gt; input<br>      .replaceAll(RegExp(r&#39;[\u200B-\u200D\uFEFF]&#39;), &#39;&#39;) // zero-width junk<br>      .replaceAll(&#39;\u00A0&#39;, &#39; &#39;)                        // non-breaking space<br>      .replaceAll(RegExp(r&#39;\s+&#39;), &#39; &#39;)<br>      .toLowerCase()<br>      .trim();<br><br>  /// &quot;4,500.00&quot; -&gt; 450000. Never store money as a double.<br>  int _toMinor(String raw) {<br>    final clean = raw.replaceAll(&#39;,&#39;, &#39;&#39;);<br>    final parts = clean.split(&#39;.&#39;);<br>    final major = int.parse(parts.first);<br>    final minor = parts.length &gt; 1<br>        ? int.parse(parts[1].padRight(2, &#39;0&#39;).substring(0, 2))<br>        : 0;<br>    return major * 100 + minor;<br>  }<br><br>  Direction? _direction(String text, BankRule rule) {<br>    for (final word in rule.debitWords) {<br>      if (text.contains(word)) return Direction.debit;<br>    }<br>    for (final word in rule.creditWords) {<br>      if (text.contains(word)) return Direction.credit;<br>    }<br>    return null;<br>  }<br>}</pre><p>Two details worth stealing:</p><p><strong>Money is an </strong><strong>int of minor units.</strong> 4500.00 as a double will eventually become 4499.999999999999 and show up in a user&#39;s monthly total as a rounding error they don&#39;t trust. Parse to paisa, store paisa, format at the edge.</p><p><strong>The counterparty regex runs against the original string, not the lowercased one.</strong> AL-FATAH STORE in caps is a merchant. store in lowercase is a word in a sentence. Throwing away the casing throws away your best signal for where the name starts and ends.</p><p>The zero-width character strip looks paranoid until you paste a real notification into a hex viewer. Some bank apps render their alerts through a templating layer that leaves \u200B scattered through the string, and your beautiful \s* matches nothing.</p><h3>Step 7: Deciding when to interrupt</h3><p>This is the part I got wrong first, and it’s the part that decides whether people keep the feature switched on.</p><p>My first build asked for confirmation on every single capture. It was technically flawless and genuinely unbearable. Fifteen notifications a day, each one demanding a tap to confirm something the app already knew.</p><p>I ran it on my own phone and lasted about a week before turning it off. I’d replaced twenty seconds of typing with a permanent low-grade interruption, which is worse — at least the typing was something you chose to do.</p><p>So the confidence score isn’t decoration — it’s the whole product decision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gBXDlJVYxagd6KY24XmrOA.png" /><figcaption>Confident enough, and it just happens. Otherwise it asks, with the work already done.</figcaption></figure><pre>// lib/capture/capture_pipeline.dart<br>class CapturePipeline {<br>  CapturePipeline._();<br>  static final instance = CapturePipeline._();<br><br>  static const _autoSaveAt = 0.85;<br>  static const _askAt = 0.55;<br><br>  final _parser = TransactionParser(bankRules);<br><br>  Future&lt;void&gt; handle(CapturedNotification n) async {<br>    // The background isolate shares nothing with the UI isolate,<br>    // so open our own handle every time.<br>    final dao = await PendingCaptureDao.open();<br><br>    if (await dao.alreadySeen(n.fingerprint)) return;<br><br>    final parsed = _parser.parse(n);<br><br>    // Write BEFORE showing anything. If the process dies here, the<br>    // capture survives and shows up in the review inbox.<br>    await dao.insert(raw: n, parsed: parsed);<br><br>    if (parsed == null) return;                      // silent — review inbox only<br><br>    if (parsed.confidence &gt;= _autoSaveAt) {<br>      final entryId = await LedgerRepository.saveFromCapture(parsed);<br>      await dao.markResolved(n.fingerprint, entryId: entryId);<br>      await CaptureNotifier.showSavedWithUndo(parsed, entryId: entryId);<br>      return;<br>    }<br><br>    if (parsed.confidence &gt;= _askAt) {<br>      await CaptureNotifier.askToAdd(parsed);<br>    }<br><br>    // Below _askAt: it stays in the inbox and says nothing. This is where<br>    // OTPs, promos and half-parsed junk land, and where they belong.<br>  }<br>}</pre><p>Keep those thresholds in a config row, not in the source. When a bank changes wording and a rule starts misfiring, you want to dial that bank down to “always ask” without shipping a release and waiting on review.</p><h3>Step 8: The duplicate problem</h3><p>You will not find this bug on an emulator. You’ll find it the first day you run the app on your own phone, with your own SIM and your own smartwatch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9-Znzn7J7ZkbEQoTCF-5Q.png" /><figcaption>One payment. Bank push, bank SMS, watch relay. Ship without a fingerprint and every coffee lands in the ledger three times.</figcaption></figure><p>The fingerprint from the Kotlin listener handles most of it, but two details make it actually work:</p><p><strong>Truncate the timestamp to the minute, not the second.</strong> The push and the SMS arrive two or three seconds apart. Hash the exact postTime and they&#39;re different events forever.</p><p><strong>Let the fingerprint expire.</strong> I keep them for 48 hours. Keep them forever and a genuine repeat payment — the same amount to the same shop two weeks later — gets silently swallowed, which is a much worse bug than a duplicate, because the user never sees it happen.</p><p>The Kotlin LRU handles the same-boot case. The database check in CapturePipeline.handle handles the case where the process was killed and restarted between the push and the SMS. You need both.</p><h3>Step 9: The pending queue</h3><p>Nothing exotic — sqflite and one table.</p><pre>CREATE TABLE pending_captures (<br>  fingerprint   TEXT    PRIMARY KEY,<br>  package       TEXT    NOT NULL,<br>  raw_text      TEXT,<br>  posted_at     INTEGER NOT NULL,<br>  bank_id       TEXT,<br>  amount_minor  INTEGER,<br>  direction     TEXT,<br>  counterparty  TEXT,<br>  account_tail  TEXT,<br>  reference     TEXT,<br>  confidence    REAL,<br>  status        TEXT    NOT NULL DEFAULT &#39;pending&#39;,<br>  entry_id      TEXT,<br>  created_at    INTEGER NOT NULL<br>);<br><br>CREATE INDEX idx_pending_status ON pending_captures (status, posted_at DESC);</pre><p>status moves through pending → resolved | rejected | expired. One housekeeping job on app start:</p><pre>Future&lt;void&gt; purge() async {<br>  final cutoff = DateTime.now()<br>      .subtract(const Duration(hours: 48))<br>      .millisecondsSinceEpoch;<br><br>  // Keep the row for dedupe, but drop the raw bank text once it&#39;s done its job.<br>  await db.rawUpdate(<br>    &quot;UPDATE pending_captures SET raw_text = NULL &quot;<br>    &quot;WHERE status != &#39;pending&#39; AND created_at &lt; ?&quot;,<br>    [cutoff],<br>  );<br><br>  await db.delete(<br>    &#39;pending_captures&#39;,<br>    where: &quot;created_at &lt; ?&quot;,<br>    whereArgs: [DateTime.now().subtract(const Duration(days: 30)).millisecondsSinceEpoch],<br>  );<br>}</pre><h3>Step 10: The notification that does the work</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0O7O_DNRzpWEgHclPs1Y-w.png" /><figcaption>The confirm notification with its actions, and the sheet that only opens when the guess needs correcting.</figcaption></figure><pre>// lib/capture/capture_notifier.dart<br>import &#39;dart:convert&#39;;<br>import &#39;package:flutter_local_notifications/flutter_local_notifications.dart&#39;;<br><br>class CaptureNotifier {<br>  static final _plugin = FlutterLocalNotificationsPlugin();<br><br>  static Future&lt;void&gt; init() async {<br>    await _plugin.initialize(<br>      const InitializationSettings(<br>        android: AndroidInitializationSettings(&#39;@mipmap/ic_launcher&#39;),<br>      ),<br>      onDidReceiveNotificationResponse: _onAction,<br>      onDidReceiveBackgroundNotificationResponse: captureActionBackground,<br>    );<br>  }<br><br>  static const _confirmChannel = AndroidNotificationDetails(<br>    &#39;capture_confirm&#39;,<br>    &#39;Caught payments&#39;,<br>    channelDescription: &#39;Asks before adding a payment we detected&#39;,<br>    importance: Importance.high,<br>    priority: Priority.high,<br>    groupKey: &#39;hisaab.capture&#39;,<br>    actions: &lt;AndroidNotificationAction&gt;[<br>      AndroidNotificationAction(&#39;capture.add&#39;, &#39;Add&#39;,<br>          showsUserInterface: false, cancelNotification: true),<br>      AndroidNotificationAction(&#39;capture.edit&#39;, &#39;Change&#39;,<br>          showsUserInterface: true),<br>      AndroidNotificationAction(&#39;capture.reject&#39;, &#39;Not an expense&#39;,<br>          showsUserInterface: false, cancelNotification: true),<br>    ],<br>  );<br><br>  static Future&lt;void&gt; askToAdd(ParsedTransaction t) async {<br>    await _plugin.show(<br>      t.notificationId,<br>      &#39;Add ${t.formattedAmount} to Hisaab?&#39;,<br>      &#39;${t.counterparty ?? &#39;Unknown&#39;}  ·  ${t.suggestedCategory}&#39;,<br>      const NotificationDetails(android: _confirmChannel),<br>      payload: jsonEncode(t.toJson()),<br>    );<br>  }<br>}<br><br>@pragma(&#39;vm:entry-point&#39;)<br>Future&lt;void&gt; captureActionBackground(NotificationResponse response) async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  if (response.payload == null) return;<br><br>  final t = ParsedTransaction.fromJson(<br>    jsonDecode(response.payload!) as Map&lt;String, dynamic&gt;,<br>  );<br><br>  switch (response.actionId) {<br>    case &#39;capture.add&#39;:<br>      final id = await LedgerRepository.saveFromCapture(t);<br>      await PendingCaptureDao.markResolved(t.fingerprint, entryId: id);<br>      break;<br>    case &#39;capture.reject&#39;:<br>      await PendingCaptureDao.markRejected(t.fingerprint);<br>      await MerchantMemory.remember(t.counterparty, isExpense: false);<br>      break;<br>    // &#39;capture.edit&#39; has showsUserInterface: true — Android opens the app<br>    // and the payload arrives through the normal launch handler.<br>  }<br>}</pre><p>The details that make or break this in real use:</p><p><strong>showsUserInterface: false on the Add action.</strong> If tapping &quot;Add&quot; opens your app, you have built a slower version of manual entry. The whole promise is that a confirmed capture never takes the user out of what they were doing.</p><p><strong>groupKey.</strong> On a busy afternoon this feature can post six notifications. Without grouping, your expense app buries every message the person actually cares about, and they uninstall you for it — not for the parsing.</p><p><strong>Remember rejections.</strong> When someone says “not an expense” for a particular merchant, that’s the single most valuable training signal you will ever get for free. MerchantMemory is a table with two columns and it improves the category guess more than any regex I&#39;ve written.</p><h3>Step 11: Asking for the permission</h3><p>This screen is where the feature lives or dies, because there is no runtime dialog you can lean on. You throw the user at a system settings list and hope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fncr4TdCiiwD5BsBrYrj-g.png" /><figcaption>Your disclosure, the system list, and the screen that proves it worked.</figcaption></figure><pre>Future&lt;void&gt; requestCaptureAccess(BuildContext context) async {<br>  if (await CaptureChannel.isGranted()) return;<br><br>  // Your own screen first, in your own words. Play policy requires the<br>  // disclosure — but you&#39;d want it anyway, because this is the moment<br>  // someone decides whether to trust you.<br>  final proceed = await showDialog&lt;bool&gt;(<br>    context: context,<br>    builder: (_) =&gt; const CaptureDisclosureSheet(),<br>  );<br>  if (proceed != true) return;<br><br>  await CaptureChannel.openSettings();<br><br>  // You cannot detect Deny. You cannot get a callback. All you can do is<br>  // check again when they come back.<br>  WidgetsBinding.instance.addObserver(_ResumeProbe(onResume: () async {<br>    if (await CaptureChannel.isGranted()) {<br>      await CaptureChannel.registerBackgroundHandler();<br>    }<br>  }));<br>}</pre><p>Three things I’d tell anyone building this screen:</p><ol><li><strong>Say what you take, in your words, before the system says it in theirs.</strong> The Android dialog says “will be able to read all notifications, including personal ones.” If that’s the first time the user hears about this, you’ve lost them. If they’ve already read your version, the scary one reads as confirmation.</li><li><strong>You cannot pre-tick the toggle, and you cannot detect a refusal.</strong> Check on resume; that’s the entire API surface you get.</li><li><strong>Come back and prove it worked.</strong> The third screen — banks detected, last catch, amount — is what converts a nervous grant into a permanent one.</li></ol><h3>Testing this without spending money</h3><p>You can’t post notifications as another package, and you definitely shouldn’t be sending yourself PKR 4,500 fifty times to test a regex. Two things solve this.</p><p><strong>A fixture corpus, run as ordinary unit tests.</strong> Every real alert a user ever sends me gets anonymised and added to this file. It has caught more regressions than anything else in the project.</p><pre>// test/capture/bank_rules_test.dart<br>class Fixture {<br>  const Fixture(this.pkg, this.text, this.minor, this.direction, this.minConfidence);<br>  final String pkg;<br>  final String text;<br>  final int minor;<br>  final Direction direction;<br>  final double minConfidence;<br>}<br><br>const fixtures = &lt;Fixture&gt;[<br>  Fixture(<br>    &#39;com.hbl.mobile&#39;,<br>    &#39;Your Acct ****4471 has been debited PKR 4,500.00 on 25-Aug-26 09:46 &#39;<br>        &#39;for IBFT to AL-FATAH STORE. Ref# 8829104477. Avl Bal PKR 61,240.00&#39;,<br>    450000, Direction.debit, 0.85,<br>  ),<br>  Fixture(<br>    &#39;com.sadapay.app&#39;,<br>    &#39;You sent PKR 4,500 to Al-Fatah Store&#39;,<br>    450000, Direction.debit, 0.55,<br>  ),<br>];<br><br>const rejects = &lt;Fixture&gt;[<br>  Fixture(&#39;com.hbl.mobile&#39;, &#39;Your OTP is 4500. Do not share it with anyone.&#39;,<br>      0, Direction.debit, 0),<br>];<br><br>void main() {<br>  const parser = TransactionParser(bankRules);<br><br>  for (final f in fixtures) {<br>    test(&#39;parses ${f.pkg}: ${f.text.substring(0, 30)}...&#39;, () {<br>      final result = parser.parse(CapturedNotification.forTest(f.pkg, f.text));<br>      expect(result, isNotNull);<br>      expect(result!.amountMinor, f.minor);<br>      expect(result.direction, f.direction);<br>      expect(result.confidence, greaterThanOrEqualTo(f.minConfidence));<br>    });<br>  }<br><br>  for (final f in rejects) {<br>    test(&#39;rejects noise: ${f.text}&#39;, () {<br>      expect(parser.parse(CapturedNotification.forTest(f.pkg, f.text)), isNull);<br>    });<br>  }<br>}</pre><p>Note that OTP fixture. Your OTP is 4500 will happily match a naive rupee regex and log a phantom expense. Every noise pattern in _noise exists because it once made it into my ledger.</p><p><strong>Two ADB commands that will save you hours.</strong> Grant the permission without tapping through settings:</p><pre>adb shell cmd notification allow_listener \<br>  com.hisaabyaar.app/com.hisaabyaar.app.capture.HisaabNotificationListener</pre><p>It needs the full package/fully.qualified.ServiceClass component — a bare package name gets you Invalid listener. Works on stock ROMs and emulators; a few OEM builds accept it silently and do nothing, in which case you&#39;re back to tapping through settings.</p><p>And see exactly what a real bank notification contains — every extras key, unredacted:</p><pre>adb shell dumpsys notification --noredact | grep -A 40 &quot;com.hbl.mobile&quot;</pre><p>That second one is how you discover the field you’re missing. Nine times out of ten the text you want is sitting in EXTRA_BIG_TEXT or EXTRA_TEXT_LINES while you&#39;re reading a truncated EXTRA_TEXT.</p><h3>The gotchas that cost me actual days</h3><ul><li><strong>Your listener dies after every app update.</strong> The binding drops and doesn’t come back until reboot or a manual toggle. Call requestRebind(ComponentName(this, HisaabNotificationListener::class.java)) on app start (API 24+). Without it, your most engaged users — the ones who update — silently lose the feature.</li><li><strong>Chinese OEM ROMs kill the service.</strong> Xiaomi, Oppo, Vivo, Realme, Infinix. You need autostart enabled and battery optimisation disabled, and neither can be done programmatically. Detect the manufacturer and show a targeted help screen with a button to Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS. Accept that some percentage of users on these devices will never have this work reliably.</li><li><strong>Never log raw notification text to Crashlytics or Sentry.</strong> It is trivially easy to do by accident — one debugPrint of a parse failure, one exception message that interpolates the input. You&#39;ve now shipped your users&#39; bank alerts to a third-party server. Log the fingerprint and the bank ID; never the text.</li><li><strong>onNotificationRemoved is not &quot;the user dismissed it.&quot;</strong> It also fires when the posting app updates or cancels its own notification. Don&#39;t attach meaning to it.</li><li><strong>The background isolate has no plugin registrants by default</strong> on older Flutter embeddings. If a plugin fails silently in the background but works in the foreground, this is why.</li></ul><h3>Getting through Play review</h3><p>Notification access is a restricted permission and your submission will be looked at by a human. What worked for me:</p><ol><li><strong>The disclosure screen is inside the app, before the settings intent, and it’s specific.</strong> Not “we need permissions to work better.” It names what is read, where it’s processed, and how to turn it off.</li><li><strong>Understand what “collected” means before you fill in the Data safety form.</strong> Google defines collection as data transmitted off the user’s device — on-device processing is explicitly excluded. So a notification parser that never sends anything anywhere doesn’t turn “no data collected” into a lie. What <em>does</em> change the answer is any optional cloud backup or sync: the moment a captured transaction can leave the phone, that’s financial info being collected, and the form has to say so. Get this right in both directions. Over-declaring confuses users; under-declaring is a policy violation.</li><li><strong>The privacy policy names the feature explicitly</strong> — the words “notification access” appear in it.</li><li><strong>A demo video.</strong> Sixty seconds: the disclosure, the grant, a real notification arriving, the capture. Reviewers have to reproduce your core functionality claim, and handing them the proof is faster than making them find it.</li><li><strong>The whitelist is the argument.</strong> “We read notifications from a fixed list of financial apps that the user selects” is a defensible sentence. “We read all notifications and filter later” is not — even if the outcome is identical.</li></ol><p>Google’s own guidance lists notification aggregation as a permitted use of this API, and lists accessing notification content without explicit user consent as a violation. Everything above is just making sure you’re clearly on the first side of that line.</p><h3>What about iOS? 😅</h3><p>There is no equivalent API, and there is not going to be one. Apps cannot read other apps’ notifications on iOS, at any entitlement level.</p><p>What I actually shipped for iOS users:</p><ul><li><strong>A share-sheet target.</strong> Long-press a bank notification, share to Hisaab Yaar, same parser, one extra tap.</li><li><strong>A Shortcuts action</strong> so people who want to can automate part of it themselves.</li><li><strong>Honest copy in the app.</strong> “Automatic capture is Android-only” beats a settings toggle that does nothing.</li></ul><p>The parser is pure Dart and doesn’t care where the string came from, which is the one architectural decision that made this cheap. Everything platform-specific lives in the two Kotlin files and nowhere else.</p><h3>Was it worth building?</h3><p>Hisaab Yaar went live on Play this week, so I don’t have retention numbers yet — and I’d rather say that than imply otherwise. What I have is a feature I’ve run on my own phone for weeks and a set of decisions I can defend.</p><p>The number I’ll be watching is the ratio of captured entries to manual ones, per user, over their first month. Manual entry is still in the app and always will be — cash, split bills, and anything a bank alert can’t tell you about. But if automatic capture is doing its job, manual should become the exception. If that ratio doesn’t move, then the parsing works and the product idea doesn’t, and those are very different problems.</p><p>The code isn’t the hard part — it’s maybe 400 lines across Kotlin and Dart, and you’ve now seen most of them. The hard parts were the three decisions:</p><ul><li><strong>Whitelist before you read</strong>, so the privacy claim is true at the line level and not just in the policy.</li><li><strong>Persist before you display</strong>, so a failed parse becomes a review item instead of a mystery.</li><li><strong>Score before you interrupt</strong>, because an expense app that asks fifteen questions a day is worse than the one that asked zero.</li></ul><p>If you’re building anything in this space, steal the confidence score first. It’s the piece that turns a clever technical demo into something people leave switched on.</p><p>If you get stuck wiring this up, or your bank’s format does something creative that breaks the parser, send it over — I’m building a corpus of these, and every odd format makes the rule set better.</p><p>The app is on Play if you want to see the thing being described: <a href="https://play.google.com/store/apps/details?id=pk.hisaabyaar.hisaabyaar">HisaabYaar</a></p><p>You can find me on LinkedIn:</p><figure><img alt="https://www.linkedin.com/in/affan-minhas/" src="https://cdn-images-1.medium.com/max/512/0*WiUVnNieBs3NakDx" /><figcaption><a href="https://www.linkedin.com/in/affan-minhas/">https://www.linkedin.com/in/affan-minhas/</a></figcaption></figure><p>If this saved you a few days, you can support more articles like it here:</p><figure><img alt="https://buymeacoffee.com/affansulta8" src="https://cdn-images-1.medium.com/proxy/1*3BFiSb2mC7FcJLye94-0Wg.png" /><figcaption><a href="https://buymeacoffee.com/affansulta8">https://buymeacoffee.com/affansulta8</a></figcaption></figure><p>#Flutter #Android #Kotlin #MobileDevelopment #AppDevelopment #FlutterDev #NotificationListener #FinTech #PersonalFinance #ExpenseTracker #BuildInPublic #IndieHacker #Pakistan #CrossPlatform #DevCommunity</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9481da429a59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate Paddle Payments in Flutter Web — 2025]]></title>
            <link>https://medium.com/blocship/how-to-integrate-paddle-payments-in-flutter-web-2025-a8fa1a2a51ef?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8fa1a2a51ef</guid>
            <category><![CDATA[paddleflutterweb]]></category>
            <category><![CDATA[paddleflutter]]></category>
            <category><![CDATA[paddle-subscription]]></category>
            <category><![CDATA[payment-integration]]></category>
            <category><![CDATA[paddlepaymentgateway]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 20:14:50 GMT</pubDate>
            <atom:updated>2025-09-06T20:23:54.710Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Integrate Paddle Payments in Flutter Web — 2025</h3><p>💡 <em>Are you building a Flutter Web app and looking for a reliable way to accept payments?</em> While Stripe and PayPal often get the spotlight, <strong>Paddle</strong> is quickly becoming a favorite for SaaS founders and developers who want a built-in checkout, tax handling, and subscription management system.</p><p>In this guide, I’ll walk you through <strong>step-by-step Paddle payment integration in Flutter Web</strong>. Since there’s almost no documentation or tutorials out there for Flutter developers, this article will be your go-to reference, from setting up your Paddle account to writing the Flutter Web code for smooth payment processing.</p><p>By the end, you’ll be able to:</p><ul><li>Connect <strong>Paddle checkout</strong> with your Flutter Web app</li><li>Accept one-time and recurring payments</li><li>Simplify tax &amp; subscription management with Paddle’s built-in features</li></ul><p>Let’s dive in 😃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJ_r7SFNiaYvXlw_8ShsTg.png" /></figure><h3>Setting Up Your Paddle Account</h3><p>Before jumping into Flutter Web code, let’s make sure you have a <strong>Paddle account ready</strong>.</p><ol><li>Go to Paddle’s website and <a href="https://login.paddle.com/signup"><strong>sign up</strong></a> for a free seller account.</li><li>Verify your email and complete the <strong>business setup</strong> (Paddle may ask for business details since they handle tax/VAT on your behalf).</li><li>Once your account is approved, head over to the <strong>Paddle Dashboard</strong>.</li><li>Now you would see the sandbox option on the main dashboard. While integrating, we will be using the sandbox environment so that we can test the payment with no charges.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Up5pIwA_hPBbDYx-kwptKg.png" /></figure><p>Remember, Paddle creates a new account for the sandbox, so you have to follow the signup steps again to create your sandbox environment. Always check the URL to understand better where you are.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5EPMOhwC1MMpxxOSgV6kBg.png" /></figure><p>If you try to log in to your live account in the sandbox environment so it won’t work.</p><p>After creating a sandbox account, your dashboard would look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kf5-CCYqzQM1IYDp45ujlg.png" /></figure><p>Now you have to create subscription products to show them on the frontend. Go to this section and create it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uud-w8sHS4aIvBao_LXItg.png" /></figure><p>Add the product details and click save. The product can be created, and then it will be treated if it is for a monthly or yearly basis. Paddle has a prices section where we can put it. First, create a product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jd3EHdGbgm45bRm6rx5dQw.png" /></figure><p>Now let’s create a price for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-BbspyjRAUmb28PEDCdtdQ.png" /></figure><p>Paddle provides this service, where it handles the taxation by itself; it’s a great one, as you have to pay it as a business.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KJZWcc-R9Eyl4eXZPW6vSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEnatWPCEGrN1c38GPeTow.png" /></figure><p>Sometimes you have a special discount for specific countries, so you can also provide it here, seta custom price for country-specific.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lbMJd98yvnXU3v9xLzcYNA.png" /></figure><p>Then hit save. You have your first monthly subscription created here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fgjn2NaAfu2GGvCZBKfTkQ.png" /></figure><p>Now, in the same way, you can create a new price for yearly. Just click on New price and add information as we did for the monthly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTreya33VTossvoNnQywGw.png" /></figure><p>You can also create a new product with advanced features, like you can name it Pro plan, and users have many more features to be activated there, and you can create monthly and yearly prices for it also.</p><p>That’s it, we have successfully created the product catalogs. 😍</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fo75ajIFH0QnQC3nCeD%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbXFvMmV2M2V3Z2JlcmFsZjBjeDNtYXpvMXZxYTQybjhla2hmbDVzciZlcD12MV9naWZzX3NlYXJjaCZjdD1n%2Fo75ajIFH0QnQC3nCeD%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExcXBoOWd1eG5oZzhwcnYydXY0OXk5aXIzODY5ODk5cXd3cWE2NHQyeiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2Fo75ajIFH0QnQC3nCeD%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="361" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d0cc69c3b014fdef45282cb5625f7fb/href">https://medium.com/media/8d0cc69c3b014fdef45282cb5625f7fb/href</a></iframe><p>Now, let’s test it on Postman and fetch the product details in JSON format so that we can use them in our application.</p><p>In order to do that, first, you would need the API key for it. Let’s create it first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMjtwcroC16-SqBnxERQkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*ma2f781oDG9yz2LI2z3MjA.png" /></figure><p>Then copy this API key and save it to some where as we will be using it while testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pqqA5vEahwBJ8FkiDQJjvQ.png" /></figure><p>Remember, you can not view this complete key again, so save it to the right place so you can get it from there again.</p><h3>Postman Testing cURL:</h3><pre>curl --location &#39;https://sandbox-api.paddle.com/products&#39; \<br>--header &#39;Authorization: Bearer pdl_sdbx_apikey_01c1h0xmgfg5qfn8mwdggt0z3a_MxVcY1G0eymEnwAjfvNp1s_AQe&#39; \<br>--header &#39;Content-Type: application/json&#39;</pre><p>Replace the token with the one you created in the previous step. When you hit, so must see the products created on the paddle.</p><h4>Response:</h4><pre>{<br>    &quot;data&quot;: [<br>        {<br>            &quot;id&quot;: &quot;pro_01k4f6dqgh8zyd5eqg96jb77nv&quot;,<br>            &quot;name&quot;: &quot;Standard Plan&quot;,<br>            &quot;tax_category&quot;: &quot;standard&quot;,<br>            &quot;type&quot;: &quot;standard&quot;,<br>            &quot;description&quot;: &quot;This is the standard plan&quot;,<br>            &quot;image_url&quot;: &quot;https://www.youriconurl.com&quot;,<br>            &quot;custom_data&quot;: null,<br>            &quot;status&quot;: &quot;active&quot;,<br>            &quot;import_meta&quot;: null,<br>            &quot;created_at&quot;: &quot;2025-09-06T09:41:22.065Z&quot;,<br>            &quot;updated_at&quot;: &quot;2025-09-06T09:41:22.065Z&quot;<br>        }<br>    ],<br>    &quot;meta&quot;: {<br>        &quot;request_id&quot;: &quot;df5be9b7-fb03-407f-85c3-8c658efc7fcb&quot;,<br>        &quot;pagination&quot;: {<br>            &quot;per_page&quot;: 50,<br>            &quot;next&quot;: &quot;https://sandbox-api.paddle.com/products?after=pro_01k4f6dqgh8zyd5eqg96jb77nv&quot;,<br>            &quot;has_more&quot;: false,<br>            &quot;estimated_total&quot;: 1<br>        }<br>    }<br>}</pre><p>So now we are getting the products correctly through the API, You will see all your products here.</p><p>We need the data on prices, with products. We also need the data, like whether it is monthly or yearly, so we can show it better.</p><pre>curl --location &#39;https://sandbox-api.paddle.com/prices?include=product&#39; \<br>--header &#39;Authorization: Bearer pdl_sdbx_apikey_01k1rtmmgfyetfn8mwi89gt0z3a_MxVcY1G0eymEnpAjfPNp1s_AQe&#39; \<br>--header &#39;Content-Type: application/json&#39;</pre><p>Don’t forget to replace your token. Mine one won’t work 🙃</p><h4>Response:</h4><pre>{<br>    &quot;data&quot;: [<br>        {<br>            &quot;id&quot;: &quot;pri_01k4f7bethk95crb19zn8znhd8&quot;,<br>            &quot;product_id&quot;: &quot;pro_01k4f6dqgh8zyd5eqg96jb77nv&quot;,<br>            &quot;type&quot;: &quot;standard&quot;,<br>            &quot;description&quot;: &quot;Your description here&quot;,<br>            &quot;name&quot;: &quot;Yearly Starter&quot;,<br>            &quot;billing_cycle&quot;: {<br>                &quot;interval&quot;: &quot;year&quot;,<br>                &quot;frequency&quot;: 1<br>            },<br>            &quot;trial_period&quot;: {<br>                &quot;interval&quot;: &quot;day&quot;,<br>                &quot;frequency&quot;: 7<br>            },<br>            &quot;tax_mode&quot;: &quot;internal&quot;,<br>            &quot;unit_price&quot;: {<br>                &quot;amount&quot;: &quot;5999&quot;,<br>                &quot;currency_code&quot;: &quot;USD&quot;<br>            },<br>            &quot;unit_price_overrides&quot;: [],<br>            &quot;custom_data&quot;: null,<br>            &quot;status&quot;: &quot;active&quot;,<br>            &quot;quantity&quot;: {<br>                &quot;minimum&quot;: 1,<br>                &quot;maximum&quot;: 1<br>            },<br>            &quot;product&quot;: {<br>                &quot;id&quot;: &quot;pro_01k4f6dqgh8zyd5eqg96jb77nv&quot;,<br>                &quot;name&quot;: &quot;Standard Plan&quot;,<br>                &quot;tax_category&quot;: &quot;standard&quot;,<br>                &quot;type&quot;: &quot;standard&quot;,<br>                &quot;description&quot;: &quot;This is the standard plan&quot;,<br>                &quot;image_url&quot;: &quot;https://www.youriconurl.com&quot;,<br>                &quot;custom_data&quot;: null,<br>                &quot;status&quot;: &quot;active&quot;,<br>                &quot;import_meta&quot;: null,<br>                &quot;created_at&quot;: &quot;2025-09-06T09:41:22.065Z&quot;,<br>                &quot;updated_at&quot;: &quot;2025-09-06T09:41:22.065Z&quot;<br>            },<br>            &quot;import_meta&quot;: null,<br>            &quot;created_at&quot;: &quot;2025-09-06T09:57:36.209384Z&quot;,<br>            &quot;updated_at&quot;: &quot;2025-09-06T09:57:36.209384Z&quot;<br>        },<br>        {<br>            &quot;id&quot;: &quot;pri_01k4f73be2y8de3brmt6p18scd&quot;,<br>            &quot;product_id&quot;: &quot;pro_01k4f6dqgh8zyd5eqg96jb77nv&quot;,<br>            &quot;type&quot;: &quot;standard&quot;,<br>            &quot;description&quot;: &quot;Your description here&quot;,<br>            &quot;name&quot;: &quot;Monthly Starter&quot;,<br>            &quot;billing_cycle&quot;: {<br>                &quot;interval&quot;: &quot;month&quot;,<br>                &quot;frequency&quot;: 1<br>            },<br>            &quot;trial_period&quot;: {<br>                &quot;interval&quot;: &quot;day&quot;,<br>                &quot;frequency&quot;: 3<br>            },<br>            &quot;tax_mode&quot;: &quot;internal&quot;,<br>            &quot;unit_price&quot;: {<br>                &quot;amount&quot;: &quot;699&quot;,<br>                &quot;currency_code&quot;: &quot;USD&quot;<br>            },<br>            &quot;unit_price_overrides&quot;: [<br>                {<br>                    &quot;country_codes&quot;: [<br>                        &quot;AX&quot;<br>                    ],<br>                    &quot;unit_price&quot;: {<br>                        &quot;amount&quot;: &quot;599&quot;,<br>                        &quot;currency_code&quot;: &quot;USD&quot;<br>                    }<br>                }<br>            ],<br>            &quot;custom_data&quot;: null,<br>            &quot;status&quot;: &quot;active&quot;,<br>            &quot;quantity&quot;: {<br>                &quot;minimum&quot;: 1,<br>                &quot;maximum&quot;: 1<br>            },<br>            &quot;product&quot;: {<br>                &quot;id&quot;: &quot;pro_01k4f6dqgh8zyd5eqg96jb77nv&quot;,<br>                &quot;name&quot;: &quot;Standard Plan&quot;,<br>                &quot;tax_category&quot;: &quot;standard&quot;,<br>                &quot;type&quot;: &quot;standard&quot;,<br>                &quot;description&quot;: &quot;This is the standard plan&quot;,<br>                &quot;image_url&quot;: &quot;https://www.youriconurl.com&quot;,<br>                &quot;custom_data&quot;: null,<br>                &quot;status&quot;: &quot;active&quot;,<br>                &quot;import_meta&quot;: null,<br>                &quot;created_at&quot;: &quot;2025-09-06T09:41:22.065Z&quot;,<br>                &quot;updated_at&quot;: &quot;2025-09-06T09:41:22.065Z&quot;<br>            },<br>            &quot;import_meta&quot;: null,<br>            &quot;created_at&quot;: &quot;2025-09-06T09:53:10.594894Z&quot;,<br>            &quot;updated_at&quot;: &quot;2025-09-06T09:53:10.594894Z&quot;<br>        }<br>    ],<br>    &quot;meta&quot;: {<br>        &quot;request_id&quot;: &quot;fdad99af-e0cb-47c7-94de-6f5e56117933&quot;,<br>        &quot;pagination&quot;: {<br>            &quot;per_page&quot;: 50,<br>            &quot;next&quot;: &quot;https://sandbox-api.paddle.com/prices?after=pri_01k4f73be2y8de3brmt6p18scd&amp;include=product&quot;,<br>            &quot;has_more&quot;: false,<br>            &quot;estimated_total&quot;: 2<br>        }<br>    }<br>}</pre><p>Now we have a detailed response about our product and pricing, also.</p><h3>Flutter Web Integration:</h3><p>I assume you have already created your Flutter web, and now you are integrating Paddle. Let’s start from here.</p><p>First, you need to load the paddle in your index.html file. Navigate to this file in your Flutter Web project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*AgyKvz59SPcJAUvubiVd5g.png" /></figure><p>You need to paste it inside your body tag.</p><pre>&lt;!-- Add Paddle.js here --&gt;<br>  &lt;script src=&quot;https://sandbox-cdn.paddle.com/paddle/v2/paddle.js&quot;&gt;&lt;/script&gt;<br>  &lt;script type=&quot;text/javascript&quot;&gt;<br>    Paddle.Environment.set(&quot;sandbox&quot;);<br>    Paddle.Initialize({<br>      token: &#39;client-side token here&#39;,<br>      checkout: {<br>        settings: {<br>          lang: &quot;en&quot;,<br>          locale: &quot;en&quot;<br>        }<br>      },<br>      eventCallback: function(data) {<br>        console.log(data);<br>        if (data.name == &quot;checkout.completed&quot;) {<br>          console.log(data);<br>          <br>          // Close checkout overlay<br>          Paddle.Checkout.close();<br><br>          window.onPaddleEvent(JSON.stringify({<br>            event: &#39;paddleSuccess&#39;,<br>            payload: data<br>          }));<br>        }<br><br>        if (data.name === &quot;checkout.closed&quot;) {<br>          console.log(&quot;Checkout closed by user&quot;);<br>        }<br>      },<br>      environment: &#39;sandbox&#39;,<br>      pwCustomer: { }<br>    });<br>  &lt;/script&gt;</pre><p>For the reference, inside the body tag here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kXkKS7IkL5O0o3ChK3c1xg.png" /></figure><p>Here, we would need the client-side token, which will be used to communicate with Paddle, to find out, go to the Paddle sandbox, and come to this section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pcGxW9SLOLa-vDOLMMmW9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*B_nAs2d-wRfNCCSMfp5X3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YPNVRuh5P29X7p5w4_Qkiw.png" /></figure><p>Now paste this token into the index.html file where I located it.</p><p>I also forced to set the language to be english, if you want it to be, choose from the browser language, so it would pick according to the browser language. You can remove it if you don’t want it.</p><pre>checkout: {<br>        settings: {<br>          lang: &quot;en&quot;,<br>          locale: &quot;en&quot;<br>        }<br>      },</pre><p>Now I have created the complete paddle service file, which will be working here to open in app checkout and also do other required things there. You can create a file named <strong>paddle_service.dart</strong></p><pre>import &#39;dart:convert&#39;;<br>import &#39;dart:developer&#39;;<br>import &#39;dart:js&#39; as js;<br>import &#39;dart:js_interop&#39;;<br><br>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:firebase_auth/firebase_auth.dart&#39;;<br>import &#39;package:firebase_core/firebase_core.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter/widgets.dart&#39;;<br>import &#39;package:tribevenuesite/pages/business/home_page/home_page_widget.dart&#39;;<br>import &#39;dart:convert&#39;;<br>import &#39;package:http/http.dart&#39; as http;<br><br>class PaddleService {<br>  BuildContext? context;<br>  bool? sandbox;<br><br>  String get _baseUrl =&gt; (sandbox ?? true)<br>      ? &#39;https://sandbox-api.paddle.com&#39;<br>      : &#39;https://api.paddle.com&#39;;<br><br>  static void openPaddleCheckout(String priceId, String email,<br>      Function onSuccess, BuildContext context) {<br>    js.context.callMethod(&#39;eval&#39;, [<br>      &#39;&#39;&#39;<br>    Paddle.Checkout.open({<br>      items: [{ priceId: &#39;$priceId&#39; }],<br>      customer: { email: &#39;$email&#39; },<br>      displayMode: &#39;overlay&#39;,<br>    });<br>    &#39;&#39;&#39;<br>    ]);<br><br>    js.context[&#39;onPaddleEvent&#39;] = (String message) async {<br>      print(&quot;Got Paddle Event from Paddle service: $message&quot;);<br><br>      // Parse the event message (depends on how Paddle sends it)<br>      // If message is JSON:<br>      try {<br>        final event = jsonDecode(message);<br><br>        if (event[&#39;event&#39;] == &#39;paddleSuccess&#39; &amp;&amp;<br>            event[&#39;payload&#39;]?[&#39;name&#39;] == &#39;checkout.completed&#39;) {<br>          final payload = event[&#39;payload&#39;][&#39;data&#39;];<br>        }<br>      } catch (e) {<br>        print(&quot;Error parsing Paddle event: $e&quot;);<br>      }<br>    }.jsify();<br>  }<br><br>  void handleCheckout(String priceId, String email, BuildContext context) {<br>    this.context = context;<br>    openPaddleCheckout(<br>      priceId,<br>      email,<br>      (dynamic successData) async {<br>        updateBusinessProfileSubscription(<br>          successData,<br>          context,<br>        );<br>      },<br>      context,<br>    );<br>  }<br><br>  static void setupFlutterJsBridge(Function onSuccess) {<br>    js.context[&#39;flutterApp&#39;] = {<br>      &#39;postMessage&#39;: (String message) {<br>        final event = jsonDecode(message);<br>        if (event[&#39;event&#39;] == &#39;paddleSuccess&#39;) {<br>          onSuccess(event[&#39;payload&#39;]);<br>        }<br>      }<br>    }.jsify();<br>  }<br><br>  Future&lt;void&gt; handleCancelByTransaction(<br>    String transactionId,<br>    BuildContext cancelContext,<br>  ) async {<br>    try {<br>      // Step 1: Get subscriptionId<br>      final subscriptionId = await getSubscriptionId(transactionId);<br><br>      if (subscriptionId == null) {<br>        throw Exception(<br>            &quot;No subscription found for transactionId: $transactionId&quot;);<br>      }<br><br>      // Step 2: Cancel subscription<br>      final result = await cancelSubscription(subscriptionId);<br>  <br>      Navigator.push(<br>        cancelContext,<br>        MaterialPageRoute(<br>          builder: (context) =&gt; const HomePageWidget(),<br>        ),<br>      );<br>    } catch (e) {<br>      rethrow;<br>    }<br>  }<br><br>  Future&lt;String?&gt; getSubscriptionId(String transactionId) async {<br>    const String functionUrl =<br>        &quot;https://getsubscriptionid-562134412429.europe-west1.run.app&quot;;<br>    try {<br>      final response = await http.get(<br>        Uri.parse(&quot;$functionUrl?transactionId=$transactionId&quot;),<br>      );<br><br>      if (response.statusCode == 200) {<br>        final data = jsonDecode(response.body);<br>        return data[&#39;subscriptionId&#39;] as String?;<br>      } else {<br>        log(&quot;❌ Error: ${response.statusCode} ${response.body}&quot;);<br>        return null;<br>      }<br>    } catch (e) {<br>      log(&quot;❌ Exception: $e&quot;);<br>      return null;<br>    }<br>  }<br><br>  Future&lt;Map&lt;String, dynamic&gt;&gt; cancelSubscription(String subscriptionId) async {<br>    const String cancelUrl =<br>        &quot;https://cancel-subscription-562134412429.europe-west1.run.app&quot;;<br>    try {<br>      final response = await http.post(<br>        Uri.parse(&quot;$cancelUrl?subscriptionId=$subscriptionId&quot;),<br>      );<br><br>      if (response.statusCode == 200) {<br>        final body = jsonDecode(response.body);<br>        return body[&#39;data&#39;] as Map&lt;String, dynamic&gt;;<br>      } else {<br>        throw Exception(<br>            &#39;❌ Failed to cancel subscription: ${response.statusCode} ${response.body}&#39;);<br>      }<br>    } catch (e) {<br>      throw Exception(&quot;⚠️ Exception during cancelSubscription: $e&quot;);<br>    }<br>  }<br><br>  Future&lt;Map&lt;String, dynamic&gt;?&gt; getSubscriptionDetails(<br>      String subscriptionId) async {<br>    const String baseUrl =<br>        &quot;https://REGION-PROJECT_ID.cloudfunctions.net/getSubscriptionDetails&quot;;<br><br>    try {<br>      final url = Uri.parse(&quot;$baseUrl?subscriptionId=$subscriptionId&quot;);<br><br>      final response = await http.get(url);<br><br>      if (response.statusCode == 200) {<br>        return jsonDecode(response.body);<br>      } else {<br>        print(&quot;Error: ${response.body}&quot;);<br>        return null;<br>      }<br>    } catch (e) {<br>      print(&quot;Exception: $e&quot;);<br>      return null;<br>    }<br>  }<br><br>}</pre><p>The first step would be showing all products on your frontend. It’s your choice how you show them. I have already given the API to list all products and so you have to create a model first and then use Paddle Services functions to do that. Let’s see how simply we can do that,</p><h3>Paddle Frontend UI:</h3><p>I created the simple paddle model here. You can customize it according to what you want.</p><h4>Paddle Model</h4><pre>class PaddleModel {<br>  final String? id;<br>  final String? productId;<br>  final String? type;<br>  final String? description;<br>  final String? name;<br>  final BillingCycleStruct? billingCycle;<br>  final TrialPeriodStruct? trialPeriod;<br>  final String? taxMode;<br>  final UnitPriceStruct? unitPrice;<br>  final List&lt;UnitPriceOverride&gt;? unitPriceOverrides;<br>  final String? status;<br>  final ProductQuantityStruct? quantity;<br>  final PaddleProductStruct? product;<br>  final String? createdAt;<br>  final String? updatedAt;<br><br>  PaddleModel({<br>    this.id,<br>    this.productId,<br>    this.type,<br>    this.description,<br>    this.name,<br>    this.billingCycle,<br>    this.trialPeriod,<br>    this.taxMode,<br>    this.unitPrice,<br>    this.unitPriceOverrides,<br>    this.status,<br>    this.quantity,<br>    this.product,<br>    this.createdAt,<br>    this.updatedAt,<br>  });<br><br>  factory PaddleModel.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return PaddleModel(<br>      id: json[&#39;id&#39;],<br>      productId: json[&#39;product_id&#39;],<br>      type: json[&#39;type&#39;],<br>      description: json[&#39;description&#39;],<br>      name: json[&#39;name&#39;],<br>      billingCycle: json[&#39;billing_cycle&#39;] != null<br>          ? BillingCycleStruct.fromJson(json[&#39;billing_cycle&#39;])<br>          : null,<br>      trialPeriod: json[&#39;trial_period&#39;] != null<br>          ? TrialPeriodStruct.fromJson(json[&#39;trial_period&#39;])<br>          : null,<br>      taxMode: json[&#39;tax_mode&#39;],<br>      unitPrice: json[&#39;unit_price&#39;] != null<br>          ? UnitPriceStruct.fromJson(json[&#39;unit_price&#39;])<br>          : null,<br>      unitPriceOverrides: (json[&#39;unit_price_overrides&#39;] as List?)<br>              ?.map((e) =&gt; UnitPriceOverride.fromJson(e))<br>              .toList() ??<br>          [],<br>      status: json[&#39;status&#39;],<br>      quantity: json[&#39;quantity&#39;] != null<br>          ? ProductQuantityStruct.fromJson(json[&#39;quantity&#39;])<br>          : null,<br>      product: json[&#39;product&#39;] != null<br>          ? PaddleProductStruct.fromJson(json[&#39;product&#39;])<br>          : null,<br>      createdAt: json[&#39;created_at&#39;],<br>      updatedAt: json[&#39;updated_at&#39;],<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;id&#39;: id,<br>      &#39;product_id&#39;: productId,<br>      &#39;type&#39;: type,<br>      &#39;description&#39;: description,<br>      &#39;name&#39;: name,<br>      &#39;billing_cycle&#39;: billingCycle?.toJson(),<br>      &#39;trial_period&#39;: trialPeriod?.toJson(),<br>      &#39;tax_mode&#39;: taxMode,<br>      &#39;unit_price&#39;: unitPrice?.toJson(),<br>      &#39;unit_price_overrides&#39;:<br>          unitPriceOverrides?.map((e) =&gt; e.toJson()).toList(),<br>      &#39;status&#39;: status,<br>      &#39;quantity&#39;: quantity?.toJson(),<br>      &#39;product&#39;: product?.toJson(),<br>      &#39;created_at&#39;: createdAt,<br>      &#39;updated_at&#39;: updatedAt,<br>    };<br>  }<br>}<br><br>class BillingCycleStruct {<br>  final String? interval;<br>  final int? frequency;<br><br>  BillingCycleStruct({this.interval, this.frequency});<br><br>  factory BillingCycleStruct.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return BillingCycleStruct(<br>      interval: json[&#39;interval&#39;],<br>      frequency: json[&#39;frequency&#39;] is int<br>          ? json[&#39;frequency&#39;]<br>          : int.tryParse(json[&#39;frequency&#39;].toString()),<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;interval&#39;: interval,<br>      &#39;frequency&#39;: frequency,<br>    };<br>  }<br>}<br><br>class TrialPeriodStruct {<br>  final String? interval;<br>  final int? frequency;<br><br>  TrialPeriodStruct({this.interval, this.frequency});<br><br>  factory TrialPeriodStruct.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return TrialPeriodStruct(<br>      interval: json[&#39;interval&#39;],<br>      frequency: json[&#39;frequency&#39;] is int<br>          ? json[&#39;frequency&#39;]<br>          : int.tryParse(json[&#39;frequency&#39;].toString()),<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;interval&#39;: interval,<br>      &#39;frequency&#39;: frequency,<br>    };<br>  }<br>}<br><br>class UnitPriceStruct {<br>  final String? currencyCode;<br>  final int? amount;<br><br>  UnitPriceStruct({this.currencyCode, this.amount});<br><br>  factory UnitPriceStruct.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return UnitPriceStruct(<br>      currencyCode: json[&#39;currency_code&#39;],<br>      amount: json[&#39;amount&#39;] == null<br>          ? null<br>          : int.tryParse(json[&#39;amount&#39;].toString()),<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;currency_code&#39;: currencyCode,<br>      &#39;amount&#39;: amount,<br>    };<br>  }<br>}<br><br>class UnitPriceOverride {<br>  final List&lt;String&gt;? countryCodes;<br>  final UnitPriceStruct? unitPrice;<br><br>  UnitPriceOverride({this.countryCodes, this.unitPrice});<br><br>  factory UnitPriceOverride.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return UnitPriceOverride(<br>      countryCodes: (json[&#39;country_codes&#39;] as List?)?.cast&lt;String&gt;(),<br>      unitPrice: json[&#39;unit_price&#39;] != null<br>          ? UnitPriceStruct.fromJson(json[&#39;unit_price&#39;])<br>          : null,<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;country_codes&#39;: countryCodes,<br>      &#39;unit_price&#39;: unitPrice?.toJson(),<br>    };<br>  }<br>}<br><br>class ProductQuantityStruct {<br>  final int? minimum;<br>  final int? maximum;<br><br>  ProductQuantityStruct({this.minimum, this.maximum});<br><br>  factory ProductQuantityStruct.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return ProductQuantityStruct(<br>      minimum: json[&#39;minimum&#39;] is int<br>          ? json[&#39;minimum&#39;]<br>          : int.tryParse(json[&#39;minimum&#39;].toString()),<br>      maximum: json[&#39;maximum&#39;] is int<br>          ? json[&#39;maximum&#39;]<br>          : int.tryParse(json[&#39;maximum&#39;].toString()),<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;minimum&#39;: minimum,<br>      &#39;maximum&#39;: maximum,<br>    };<br>  }<br>}<br><br>class PaddleProductStruct {<br>  final String? id;<br>  final String? name;<br>  final String? description;<br>  final String? type;<br>  final String? taxCategory;<br>  final String? imageUrl;<br>  final String? status;<br>  final String? createdAt;<br>  final String? updatedAt;<br><br>  PaddleProductStruct({<br>    this.id,<br>    this.name,<br>    this.description,<br>    this.type,<br>    this.taxCategory,<br>    this.imageUrl,<br>    this.status,<br>    this.createdAt,<br>    this.updatedAt,<br>  });<br><br>  factory PaddleProductStruct.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return PaddleProductStruct(<br>      id: json[&#39;id&#39;],<br>      name: json[&#39;name&#39;],<br>      description: json[&#39;description&#39;],<br>      type: json[&#39;type&#39;],<br>      taxCategory: json[&#39;tax_category&#39;],<br>      imageUrl: json[&#39;image_url&#39;],<br>      status: json[&#39;status&#39;],<br>      createdAt: json[&#39;created_at&#39;],<br>      updatedAt: json[&#39;updated_at&#39;],<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;id&#39;: id,<br>      &#39;name&#39;: name,<br>      &#39;description&#39;: description,<br>      &#39;type&#39;: type,<br>      &#39;tax_category&#39;: taxCategory,<br>      &#39;image_url&#39;: imageUrl,<br>      &#39;status&#39;: status,<br>      &#39;created_at&#39;: createdAt,<br>      &#39;updated_at&#39;: updatedAt,<br>    };<br>  }<br>}<br><br>class Meta {<br>  final String? requestId;<br>  final Pagination? pagination;<br><br>  Meta({this.requestId, this.pagination});<br><br>  factory Meta.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return Meta(<br>      requestId: json[&#39;request_id&#39;],<br>      pagination: json[&#39;pagination&#39;] != null<br>          ? Pagination.fromJson(json[&#39;pagination&#39;])<br>          : null,<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;request_id&#39;: requestId,<br>      &#39;pagination&#39;: pagination?.toJson(),<br>    };<br>  }<br>}<br><br>class Pagination {<br>  final int? perPage;<br>  final String? next;<br>  final bool? hasMore;<br>  final int? estimatedTotal;<br><br>  Pagination({this.perPage, this.next, this.hasMore, this.estimatedTotal});<br><br>  factory Pagination.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return Pagination(<br>      perPage: json[&#39;per_page&#39;],<br>      next: json[&#39;next&#39;],<br>      hasMore: json[&#39;has_more&#39;],<br>      estimatedTotal: json[&#39;estimated_total&#39;],<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    return {<br>      &#39;per_page&#39;: perPage,<br>      &#39;next&#39;: next,<br>      &#39;has_more&#39;: hasMore,<br>      &#39;estimated_total&#39;: estimatedTotal,<br>    };<br>  }<br>}</pre><p>I use Google Cloud Functions to fetch the products because when accessed directly, so gives CORS issues. It means we can’t access it directly here so I use Node.js function to fetch it as an API, and then that fetches it there.</p><p>You can also use your custom server if you have and then call this API on your backend and provide the response in the frontend.</p><p>I am showing the Google Cloud way, so writing the Cloud function for it. You need to create a Google Cloud account for your project. You can see on Google how to do that. After that, you need to go to your project and select your project, and navigate to <strong>Cloud Run Function</strong> to create a new one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EOOflVs6TypJNOdH8QjBDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDgHnUf4zjDKrSPJAB-s8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*up-KRv9JgHjzGh21f1zz8w.png" /></figure><p>I am showing the basic setup of it. You can follow these,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*Me3mpLXaij6uNeS6oyaPdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*MAoPXSrSRLetesgwDwroJQ.png" /></figure><p>Paste this code in the source section:</p><pre>const functions = require(&#39;@google-cloud/functions-framework&#39;);<br>const axios = require(&#39;axios&#39;);<br><br>// Set this using environment variables during deployment<br>const PADDLE_API_KEY = process.env.PADDLE_API_KEY;<br><br>functions.http(&#39;getPaddleProducts&#39;, async (req, res) =&gt; {<br>  // Handle CORS preflight<br>  if (req.method === &#39;OPTIONS&#39;) {<br>    res.set({<br>      &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;,<br>      &#39;Access-Control-Allow-Methods&#39;: &#39;GET&#39;,<br>      &#39;Access-Control-Allow-Headers&#39;: &#39;Content-Type&#39;,<br>      &#39;Access-Control-Max-Age&#39;: &#39;3600&#39;,<br>    });<br>    return res.status(204).send(&#39;&#39;);<br>  }<br><br>  try {<br>    const paddleResponse = await axios.get(&#39;https://sandbox-api.paddle.com/prices?include=product&#39;, {<br>      headers: {<br>        Authorization: `Bearer ${PADDLE_API_KEY}`,<br>        &#39;Content-Type&#39;: &#39;application/json&#39;,<br>      },<br>    });<br><br>    res.set(&#39;Access-Control-Allow-Origin&#39;, &#39;*&#39;);<br>    return res.status(200).json({<br>      status: &#39;success&#39;,<br>      products: paddleResponse.data.data || [],<br>    });<br>  } catch (error) {<br>    res.set(&#39;Access-Control-Allow-Origin&#39;, &#39;*&#39;);<br>    return res.status(500).json({<br>      status: &#39;error&#39;,<br>      message: error.message,<br>    });<br>  }<br>});</pre><p>Now, you need to set your package.json file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*kOprVHF3WjEfFL7Y7x6KjQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*JoFBcvsyEtynB1V7NMkbvQ.png" /></figure><p>After successfully deploying, you would see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*nRB_S9vd3xClHZanz2lgCQ.png" /></figure><p>No, we also need to set the environment variable where we would set the API key for Paddle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*H4BTRPrsMaexti4QMUESUw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*jGutJiEY_KmSNGHzNqF6Qg.png" /></figure><p>Now paste your API key that we created on the Paddle dashboard, and I told you to save it somewhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*YTma1pF9VUx89gM3AW7IzQ.png" /></figure><p>Now it&#39;s all set up, and you can use the URL to get the products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*0OX9AITSH_bSv4ynYxLn2Q.png" /></figure><p>So now, you use the dart function to fetch the products; that is, you will call this function first.</p><pre>import &#39;dart:convert&#39;;<br>import &#39;package:http/http.dart&#39; as http;<br><br>Future&lt;List&lt;PaddleModelStruct&gt;&gt; fetchPaddleProducts() async {<br>  final uri =<br>      Uri.parse(&#39;https://your-url-here&#39;);<br><br>  final response = await http.get(uri);<br><br>  if (response.statusCode == 200) {<br>    final decoded = jsonDecode(response.body);<br>    print(decoded);<br><br>    if (decoded[&#39;status&#39;] == &#39;success&#39; &amp;&amp; decoded[&#39;products&#39;] is List) {<br>      final List&lt;dynamic&gt; products = decoded[&#39;products&#39;];<br>      return products.map((p) =&gt; PaddleModelStruct.fromMap(p)).toList();<br>    } else {<br>      throw Exception(&#39;Unexpected response format&#39;);<br>    }<br>  } else {<br>    throw Exception(&#39;Failed to fetch Paddle products: ${response.statusCode}&#39;);<br>  }<br>}</pre><p>I also designed the UI to show that products but it’s up to you, if you wanna follow it, so you can. You might need to do some configuration, and you also have to work with imports because they may cause issues. I am sharing it to have an idea of how I am showing it on the frontend.</p><h4>Main Subscription View:</h4><pre>import &#39;/backend/backend.dart&#39;;<br>import &#39;/backend/schema/structs/index.dart&#39;;<br>import &#39;dart:ui&#39;;<br>import &#39;/custom_code/actions/index.dart&#39; as actions;<br>import &#39;/custom_code/widgets/index.dart&#39; as custom_widgets;<br>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter/scheduler.dart&#39;;<br>import &#39;package:google_fonts/google_fonts.dart&#39;;<br>import &#39;package:provider/provider.dart&#39;;<br><br>import &#39;subscription_view_model.dart&#39;;<br>export &#39;subscription_view_model.dart&#39;;<br><br>class SubscriptionViewWidget extends StatefulWidget {<br>  const SubscriptionViewWidget({<br>    super.key,<br>    required this.venueRef,<br>  });<br><br>  final DocumentReference? venueRef;<br><br>  static String routeName = &#39;subscriptionView_old&#39;;<br>  static String routePath = &#39;/subscriptionViewOld&#39;;<br><br>  @override<br>  State&lt;SubscriptionViewWidget&gt; createState() =&gt;<br>      _SubscriptionViewWidgetState();<br>}<br><br>class _SubscriptionViewWidgetState extends State&lt;SubscriptionVieWidget&gt; {<br>  late SubscriptionViewModel _model;<br><br>  final scaffoldKey = GlobalKey&lt;ScaffoldState&gt;();<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    _model = createModel(context, () =&gt; SubscriptionViewModel());<br><br>    // On page load action.<br>    SchedulerBinding.instance.addPostFrameCallback((_) async {<br>      _model.products = await actions.fetchPaddleProducts();<br>      _model.isLoading = false;<br>      safeSetState(() {});<br>    });<br><br>    WidgetsBinding.instance.addPostFrameCallback((_) =&gt; safeSetState(() {}));<br>  }<br><br>  @override<br>  void dispose() {<br>    _model.dispose();<br><br>    super.dispose();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return GestureDetector(<br>      onTap: () {<br>        FocusScope.of(context).unfocus();<br>        FocusManager.instance.primaryFocus?.unfocus();<br>      },<br>      child: Scaffold(<br>        key: scaffoldKey,<br>        backgroundColor: FlutterFlowTheme.of(context).primaryBackground,<br>        body: SafeArea(<br>          top: true,<br>          child: Container(<br>            decoration: BoxDecoration(<br>              color: FlutterFlowTheme.of(context).primaryBackground,<br>            ),<br>            child: Row(<br>              mainAxisSize: MainAxisSize.max,<br>              children: [<br>                Expanded(<br>                  child: Container(<br>                    decoration: BoxDecoration(),<br>                    child: SingleChildScrollView(<br>                      child: Column(<br>                        mainAxisSize: MainAxisSize.max,<br>                        mainAxisAlignment: MainAxisAlignment.start,<br>                        crossAxisAlignment: CrossAxisAlignment.start,<br>                        children: [<br>                          Padding(<br>                            padding:<br>                                EdgeInsetsDirectional.fromSTEB(30, 10, 0, 0),<br>                            child: InkWell(<br>                              splashColor: Colors.transparent,<br>                              focusColor: Colors.transparent,<br>                              hoverColor: Colors.transparent,<br>                              highlightColor: Colors.transparent,<br>                              onTap: () async {<br>                                Navigator.pop(context);<br>                              },<br>                              child: Icon(<br>                                Icons.arrow_back,<br>                                color: FlutterFlowTheme.of(context).primaryText,<br>                                size: 40,<br>                              ),<br>                            ),<br>                          ),<br>                          Expanded(<br>                            child: Padding(<br>                              padding:<br>                                  EdgeInsetsDirectional.fromSTEB(0, 20, 0, 20),<br>                              child: Row(<br>                                mainAxisSize: MainAxisSize.max,<br>                                mainAxisAlignment: MainAxisAlignment.center,<br>                                crossAxisAlignment: CrossAxisAlignment.center,<br>                                children: [<br>                                  Container(<br>                                    constraints: BoxConstraints(<br>                                      maxWidth: 730,<br>                                    ),<br>                                    decoration: BoxDecoration(<br>                                      color: FlutterFlowTheme.of(context)<br>                                          .secondaryBackground,<br>                                    ),<br>                                    child: Column(<br>                                      mainAxisSize: MainAxisSize.max,<br>                                      children: [<br>                                        Padding(<br>                                          padding:<br>                                              EdgeInsetsDirectional.fromSTEB(<br>                                                  0, 20, 0, 0),<br>                                          child: Text(<br>                                            &#39;Our Subscription Plan&#39;,<br>                                            style: FlutterFlowTheme.of(context)<br>                                                .displaySmall<br>                                                .override(<br>                                                  fontFamily:<br>                                                      FlutterFlowTheme.of(<br>                                                              context)<br>                                                          .displaySmallFamily,<br>                                                  letterSpacing: 0.0,<br>                                                  useGoogleFonts:<br>                                                      !FlutterFlowTheme.of(<br>                                                              context)<br>                                                          .displaySmallIsCustom,<br>                                                ),<br>                                          ),<br>                                        ),<br>                                        Padding(<br>                                          padding:<br>                                              EdgeInsetsDirectional.fromSTEB(<br>                                                  0, 10, 0, 0),<br>                                          child: Text(<br>                                            &#39;You can subscribe to one of the available plan &#39;,<br>                                            style: FlutterFlowTheme.of(context)<br>                                                .bodySmall<br>                                                .override(<br>                                                  fontFamily:<br>                                                      FlutterFlowTheme.of(<br>                                                              context)<br>                                                          .bodySmallFamily,<br>                                                  fontSize: 20,<br>                                                  letterSpacing: 0.0,<br>                                                  useGoogleFonts:<br>                                                      !FlutterFlowTheme.of(<br>                                                              context)<br>                                                          .bodySmallIsCustom,<br>                                                ),<br>                                          ),<br>                                        ),<br>                                        if (!_model.isLoading)<br>                                          Padding(<br>                                            padding:<br>                                                EdgeInsetsDirectional.fromSTEB(<br>                                                    0, 30, 0, 0),<br>                                            child: SingleChildScrollView(<br>                                              child: Column(<br>                                                mainAxisSize: MainAxisSize.max,<br>                                                children: [<br>                                                  Padding(<br>                                                    padding:<br>                                                        EdgeInsetsDirectional<br>                                                            .fromSTEB(<br>                                                                10, 0, 10, 0),<br>                                                    child: Builder(<br>                                                      builder: (context) {<br>                                                        final product = _model<br>                                                            .products!<br>                                                            .sortedList(<br>                                                                keyOf: (e) =&gt; e<br>                                                                    .unitPrice<br>                                                                    .amount,<br>                                                                desc: false)<br>                                                            .toList();<br><br>                                                        return Column(<br>                                                          mainAxisSize:<br>                                                              MainAxisSize.max,<br>                                                          children: List.generate(<br>                                                              product.length,<br>                                                              (productIndex) {<br>                                                            final productItem =<br>                                                                product[<br>                                                                    productIndex];<br>                                                            return Padding(<br>                                                              padding:<br>                                                                  EdgeInsetsDirectional<br>                                                                      .fromSTEB(<br>                                                                          16,<br>                                                                          0,<br>                                                                          16,<br>                                                                          0),<br>                                                              child: Container(<br>                                                                width: double<br>                                                                    .infinity,<br>                                                                decoration:<br>                                                                    BoxDecoration(<br>                                                                  color: Colors<br>                                                                      .white,<br>                                                                  boxShadow: [<br>                                                                    BoxShadow(<br>                                                                      blurRadius:<br>                                                                          5,<br>                                                                      color: Color(<br>                                                                          0x34111417),<br>                                                                      offset:<br>                                                                          Offset(<br>                                                                        0.0,<br>                                                                        2,<br>                                                                      ),<br>                                                                    )<br>                                                                  ],<br>                                                                  borderRadius:<br>                                                                      BorderRadius<br>                                                                          .circular(<br>                                                                              14),<br>                                                                  border: Border<br>                                                                      .all(<br>                                                                    color: valueOrDefault&lt;<br>                                                                        Color&gt;(<br>                                                                      productItem.id ==<br>                                                                              _model<br>                                                                                  .selectedSubscription?.id<br>                                                                          ? FlutterFlowTheme.of(context)<br>                                                                              .tertiary<br>                                                                          : FlutterFlowTheme.of(context)<br>                                                                              .primary,<br>                                                                      FlutterFlowTheme.of(<br>                                                                              context)<br>                                                                          .primary,<br>                                                                    ),<br>                                                                    width: 2,<br>                                                                  ),<br>                                                                ),<br>                                                                child: Padding(<br>                                                                  padding: EdgeInsetsDirectional<br>                                                                      .fromSTEB(<br>                                                                          0,<br>                                                                          0,<br>                                                                          0,<br>                                                                          12),<br>                                                                  child: Column(<br>                                                                    mainAxisSize:<br>                                                                        MainAxisSize<br>                                                                            .max,<br>                                                                    mainAxisAlignment:<br>                                                                        MainAxisAlignment<br>                                                                            .center,<br>                                                                    crossAxisAlignment:<br>                                                                        CrossAxisAlignment<br>                                                                            .start,<br>                                                                    children: [<br>                                                                      InkWell(<br>                                                                        splashColor:<br>                                                                            Colors.transparent,<br>                                                                        focusColor:<br>                                                                            Colors.transparent,<br>                                                                        hoverColor:<br>                                                                            Colors.transparent,<br>                                                                        highlightColor:<br>                                                                            Colors.transparent,<br>                                                                        onTap:<br>                                                                            () async {<br>                                                                          _model.selectedSubscription =<br>                                                                              productItem;<br>                                                                          safeSetState(<br>                                                                              () {});<br>                                                                        },<br>                                                                        child:<br>                                                                            Container(<br>                                                                          width:<br>                                                                              double.infinity,<br>                                                                          height:<br>                                                                              90,<br>                                                                          decoration:<br>                                                                              BoxDecoration(<br>                                                                            color:<br>                                                                                valueOrDefault&lt;Color&gt;(<br>                                                                              productItem.id == _model.selectedSubscription?.id ? FlutterFlowTheme.of(context).tertiary : FlutterFlowTheme.of(context).primary,<br>                                                                              FlutterFlowTheme.of(context).primary,<br>                                                                            ),<br>                                                                            borderRadius:<br>                                                                                BorderRadius.only(<br>                                                                              bottomLeft: Radius.circular(0),<br>                                                                              bottomRight: Radius.circular(0),<br>                                                                              topLeft: Radius.circular(12),<br>                                                                              topRight: Radius.circular(12),<br>                                                                            ),<br>                                                                          ),<br>                                                                          child:<br>                                                                              Padding(<br>                                                                            padding: EdgeInsetsDirectional.fromSTEB(<br>                                                                                18,<br>                                                                                0,<br>                                                                                0,<br>                                                                                0),<br>                                                                            child:<br>                                                                                Row(<br>                                                                              mainAxisSize: MainAxisSize.max,<br>                                                                              children: [<br>                                                                                Column(<br>                                                                                  mainAxisSize: MainAxisSize.max,<br>                                                                                  mainAxisAlignment: MainAxisAlignment.center,<br>                                                                                  crossAxisAlignment: CrossAxisAlignment.start,<br>                                                                                  children: [<br>                                                                                    Text(<br>                                                                                      valueOrDefault&lt;String&gt;(<br>                                                                                        productItem.product.name,<br>                                                                                        &#39;Name&#39;,<br>                                                                                      ),<br>                                                                                      style: FlutterFlowTheme.of(context).bodyMedium.override(<br>                                                                                            font: GoogleFonts.poppins(<br>                                                                                              fontWeight: FontWeight.w600,<br>                                                                                              fontStyle: FlutterFlowTheme.of(context).bodyMedium.fontStyle,<br>                                                                                            ),<br>                                                                                            color: FlutterFlowTheme.of(context).secondaryBackground,<br>                                                                                            fontSize: 24,<br>                                                                                            letterSpacing: 0.0,<br>                                                                                            fontWeight: FontWeight.w600,<br>                                                                                            fontStyle: FlutterFlowTheme.of(context).bodyMedium.fontStyle,<br>                                                                                          ),<br>                                                                                    ),<br>                                                                                  ],<br>                                                                                ),<br>                                                                                Padding(<br>                                                                                  padding: EdgeInsetsDirectional.fromSTEB(10, 0, 0, 0),<br>                                                                                  child: Text(<br>                                                                                    &#39;\$${(int.parse(productItem.unitPrice.amount) / 100).toString()}/${productItem.billingCycle.interval}&#39;,<br>                                                                                    style: FlutterFlowTheme.of(context).bodyMedium.override(<br>                                                                                          font: GoogleFonts.poppins(<br>                                                                                            fontWeight: FontWeight.w500,<br>                                                                                            fontStyle: FlutterFlowTheme.of(context).bodyMedium.fontStyle,<br>                                                                                          ),<br>                                                                                          color: FlutterFlowTheme.of(context).secondaryBackground,<br>                                                                                          fontSize: 16,<br>                                                                                          letterSpacing: 0.0,<br>                                                                                          fontWeight: FontWeight.w500,<br>                                                                                          fontStyle: FlutterFlowTheme.of(context).bodyMedium.fontStyle,<br>                                                                                        ),<br>                                                                                  ),<br>                                                                                ),<br>                                                                              ],<br>                                                                            ),<br>                                                                          ),<br>                                                                        ),<br>                                                                      ),<br>                                                                      Padding(<br>                                                                        padding: EdgeInsetsDirectional.fromSTEB(<br>                                                                            12,<br>                                                                            10,<br>                                                                            24,<br>                                                                            0),<br>                                                                        child:<br>                                                                            Text(<br>                                                                          valueOrDefault&lt;<br>                                                                              String&gt;(<br>                                                                            productItem.product.description,<br>                                                                            &#39;description&#39;,<br>                                                                          ),<br>                                                                          style: FlutterFlowTheme.of(context)<br>                                                                              .labelMedium<br>                                                                              .override(<br>                                                                                font: GoogleFonts.poppins(<br>                                                                                  fontWeight: FontWeight.w500,<br>                                                                                  fontStyle: FlutterFlowTheme.of(context).labelMedium.fontStyle,<br>                                                                                ),<br>                                                                                color: Color(0xFF57636C),<br>                                                                                fontSize: 14,<br>                                                                                letterSpacing: 0.0,<br>                                                                                fontWeight: FontWeight.w500,<br>                                                                                fontStyle: FlutterFlowTheme.of(context).labelMedium.fontStyle,<br>                                                                              ),<br>                                                                        ),<br>                                                                      ),<br>                                                                    ],<br>                                                                  ),<br>                                                                ),<br>                                                              ),<br>                                                            );<br>                                                          }).divide(SizedBox(<br>                                                              height: 15)),<br>                                                        );<br>                                                      },<br>                                                    ),<br>                                                  ),<br>                                                  Align(<br>                                                    alignment:<br>                                                        AlignmentDirectional(<br>                                                            0, 0),<br>                                                    child: Padding(<br>                                                      padding:<br>                                                          EdgeInsetsDirectional<br>                                                              .fromSTEB(<br>                                                                  0, 30, 0, 24),<br>                                                      child: Column(<br>                                                        mainAxisSize:<br>                                                            MainAxisSize.max,<br>                                                        mainAxisAlignment:<br>                                                            MainAxisAlignment<br>                                                                .end,<br>                                                        children: [<br>                                                          FFButtonWidget(<br>                                                            onPressed:<br>                                                                (_model.selectedSubscription ==<br>                                                                        null)<br>                                                                    ? null<br>                                                                    : () async {<br>                                                                       /// Here you will call the function which I will mention in next step <br>                                                                      },<br>                                                            text: &#39;Subscribe&#39;,<br>                                                            options:<br>                                                                FFButtonOptions(<br>                                                              width: 270,<br>                                                              height: 50,<br>                                                              padding:<br>                                                                  EdgeInsetsDirectional<br>                                                                      .fromSTEB(<br>                                                                          0,<br>                                                                          0,<br>                                                                          0,<br>                                                                          0),<br>                                                              iconPadding:<br>                                                                  EdgeInsetsDirectional<br>                                                                      .fromSTEB(<br>                                                                          0,<br>                                                                          0,<br>                                                                          0,<br>                                                                          0),<br>                                                              color: FlutterFlowTheme<br>                                                                      .of(context)<br>                                                                  .primary,<br>                                                              textStyle:<br>                                                                  FlutterFlowTheme.of(<br>                                                                          context)<br>                                                                      .titleSmall<br>                                                                      .override(<br>                                                                        font: GoogleFonts<br>                                                                            .outfit(<br>                                                                          fontWeight:<br>                                                                              FontWeight.normal,<br>                                                                          fontStyle: FlutterFlowTheme.of(context)<br>                                                                              .titleSmall<br>                                                                              .fontStyle,<br>                                                                        ),<br>                                                                        color: Color(<br>                                                                            0xFFF1F4F8),<br>                                                                        fontSize:<br>                                                                            16,<br>                                                                        letterSpacing:<br>                                                                            0.0,<br>                                                                        fontWeight:<br>                                                                            FontWeight.normal,<br>                                                                        fontStyle: FlutterFlowTheme.of(context)<br>                                                                            .titleSmall<br>                                                                            .fontStyle,<br>                                                                      ),<br>                                                              elevation: 2,<br>                                                              borderSide:<br>                                                                  BorderSide(<br>                                                                color: Colors<br>                                                                    .transparent,<br>                                                                width: 1,<br>                                                              ),<br>                                                              borderRadius:<br>                                                                  BorderRadius<br>                                                                      .circular(<br>                                                                          12),<br>                                                            ),<br>                                                          ),<br>                                                        ],<br>                                                      ),<br>                                                    ),<br>                                                  ),<br>                                                ],<br>                                              ),<br>                                            ),<br>                                          ),<br>                                      ],<br>                                    ),<br>                                  ),<br>                                ],<br>                              ),<br>                            ),<br>                          ),<br>                          if (_model.isLoading)<br>                            Expanded(<br>                              child: Align(<br>                                alignment: AlignmentDirectional(0, 0),<br>                                child: Container(<br>                                  width: 45,<br>                                  height: 45,<br>                                  child: custom_widgets.CustomLoader(<br>                                    width: 45,<br>                                    height: 45,<br>                                    size: 45.0,<br>                                    color: FlutterFlowTheme.of(context).primary,<br>                                  ),<br>                                ),<br>                              ),<br>                            ),<br>                        ],<br>                      ),<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h4>Subscription Model View:</h4><pre>import &#39;/backend/backend.dart&#39;;<br>import &#39;/backend/schema/structs/index.dart&#39;;<br>import &#39;dart:ui&#39;;<br>import &#39;/custom_code/actions/index.dart&#39; as actions;<br>import &#39;/custom_code/widgets/index.dart&#39; as custom_widgets;<br>import &#39;subscription_view_old_widget.dart&#39; show SubscriptionViewWidget;<br>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter/scheduler.dart&#39;;<br>import &#39;package:google_fonts/google_fonts.dart&#39;;<br>import &#39;package:provider/provider.dart&#39;;<br><br>class SubscriptionViewModel<br>    extends FlutterFlowModel&lt;SubscriptionViewWidget&gt; {<br>  ///  Local state fields for this page.<br><br>  bool isLoading = true;<br><br>  PaddleModel? selectedSubscription;<br>  void updateSelectedSubscriptionStruct(Function(PaddleModel) updateFn) {<br>    updateFn(selectedSubscription ??= PaddleModel());<br>  }<br><br>  ///  State fields for stateful widgets in this page.<br><br>  // Stores action output result for [Custom Action - fetchPaddleProducts] action in subscriptionView_old widget.<br>  List&lt;PaddleModel&gt;? products;<br><br>  @override<br>  void initState(BuildContext context) {}<br><br>  @override<br>  void dispose() {}<br>}</pre><p>Now, let’s say you have designed the front-end, and now the list of products is showing there, and then when a user wanna subscribed to any product, then you have to call a function that I listed on the Paddle service file that is:</p><pre>void handleCheckout(String priceId, String email, BuildContext context) {<br>    this.context = context;<br>    openPaddleCheckout(<br>      priceId,<br>      email,<br>      (dynamic successData) async {<br>        //  Here now you can do your backend update like this user <br>        //  has subcribed and save necessary info. I did like below<br>        // updateBusinessProfileSubscription(<br>        //  successData,<br>         // context,<br>         // venueRef: venueRef,<br>       // );<br>      },<br>      context,<br>    );<br>  }<br><br>static void openPaddleCheckout(String priceId, String email,<br>      Function onSuccess, BuildContext context) {<br>    js.context.callMethod(&#39;eval&#39;, [<br>      &#39;&#39;&#39;<br>    Paddle.Checkout.open({<br>      items: [{ priceId: &#39;$priceId&#39; }],<br>      customer: { email: &#39;$email&#39; },<br>      displayMode: &#39;overlay&#39;,<br>    });<br>    &#39;&#39;&#39;<br>    ]);<br><br>    js.context[&#39;onPaddleEvent&#39;] = (String message) async {<br>      print(&quot;Got Paddle Event from Paddle service: $message&quot;);<br><br>      // Parse the event message (depends on how Paddle sends it)<br>      // If message is JSON:<br>      try {<br>        final event = jsonDecode(message);<br><br>        if (event[&#39;event&#39;] == &#39;paddleSuccess&#39; &amp;&amp;<br>            event[&#39;payload&#39;]?[&#39;name&#39;] == &#39;checkout.completed&#39;) {<br>          final payload = event[&#39;payload&#39;][&#39;data&#39;];<br>            <br>          //  Here now you can do your backend update like this user <br>          //  has subcribed and save necessary info. I did like below<br><br>          // await PaddleService().updateBusinessProfileSubscription(<br>          //   payload,<br>          //   context,<br>          // );<br>        }<br>      } catch (e) {<br>        print(&quot;Error parsing Paddle event: $e&quot;);<br>      }<br>    }<br>.jsify();<br>  }</pre><p>You would be calling like this:</p><pre>onPressed: () async{<br>  PaddleService().handleCheckout(<br>    monthlyProductItem.id, // The item that user will select<br>    currentUserEmail, // Current user email here<br>    context,<br>  );<br>},</pre><p>This would open the paddle checkout screen with all the details of the plan filled in. It would be in test mode as we are on it right now. After testing, you can enter your live key to accept real payments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*NfzObwyc2BTGIYX7VtvA3g.png" /></figure><p>After that, you can enter the test card details to see if it’s working or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*bhyqdKKQG2SHqETKq_iA8g.png" /></figure><p>After that, it would show the success screen, and you can navigate to the screen you want after success.</p><p>That’s it, we have successfully integrated the paddle payment integration 🥳</p><h4>Cancel Subscription:</h4><p>In order to cancel the subscription, we have to take some steps. We would need first the transaction ID, and we would need to call some API’s for it. Let’s do that.</p><p>This would be the function for handling it.</p><pre>Future&lt;void&gt; handleCancelByTransaction(<br>    String transactionId,<br>    BuildContext cancelContext,<br>  ) async {<br>    try {<br>      // Step 1: Get subscriptionId<br>      final subscriptionId = await getSubscriptionId(transactionId);<br><br>      if (subscriptionId == null) {<br>        throw Exception(<br>            &quot;No subscription found for transactionId: $transactionId&quot;);<br>      }<br><br>      // Step 2: Cancel subscription<br>      final result = await cancelSubscription(subscriptionId);<br>      // Here you can write your logic to update the backend that user <br>      // has cancel the plan<br>      Navigator.push(<br>        cancelContext,<br>        MaterialPageRoute(<br>          builder: (context) =&gt; const HomePageWidget(),<br>        ),<br>      );<br>    } catch (e) {<br>      rethrow;<br>    }<br>  }</pre><p>First, we need to get the subscription ID from the Paddle platform. I assume you already saved the transaction ID in the backend when the user subscribed to it. Now we need to pass that transaction ID and get the subscription ID for it. If you have already saved the subscription ID so you can skip this step.</p><pre>Future&lt;String?&gt; getSubscriptionId(String transactionId) async {<br>    const String functionUrl =<br>        &quot;https://getsubscriptionid-562134412429.europe-west1.run.app&quot;;<br>    try {<br>      final response = await http.get(<br>        Uri.parse(&quot;$functionUrl?transactionId=$transactionId&quot;),<br>      );<br><br>      if (response.statusCode == 200) {<br>        final data = jsonDecode(response.body);<br>        return data[&#39;subscriptionId&#39;] as String?;<br>      } else {<br>        log(&quot;❌ Error: ${response.statusCode} ${response.body}&quot;);<br>        return null;<br>      }<br>    } catch (e) {<br>      log(&quot;❌ Exception: $e&quot;);<br>      return null;<br>    }<br>  }</pre><p>I also wrote this as a cloud function, and now calling here, let me show how you can also write the cloud function for the <strong>getSubscriptionId.</strong></p><p>I have already shown the steps to create a cloud function and put the function name, set the environment variable, so please follow those steps from above that I already showed. Here is the source code for that function:</p><pre>const fetch = require(&#39;node-fetch&#39;);<br><br>exports.getSubscriptionId = async (req, res) =&gt; {<br>   // Always set CORS headers<br>  res.set(&#39;Access-Control-Allow-Origin&#39;, &#39;*&#39;);<br>  res.set(&#39;Access-Control-Allow-Methods&#39;, &#39;GET, POST, OPTIONS&#39;);<br>  res.set(&#39;Access-Control-Allow-Headers&#39;, &#39;Content-Type&#39;);<br><br>  // Handle CORS preflight request<br>  if (req.method === &#39;OPTIONS&#39;) {<br>    return res.status(204).send(&#39;&#39;);<br>  }<br><br>  try {<br>    const transactionId = req.query.transactionId || req.body.transactionId;<br>    if (!transactionId) {<br>      return res.status(400).json({ error: &#39;Missing transactionId&#39; });<br>    }<br><br>    const url = `${process.env.BASE_URL}/transactions/${transactionId}`;<br>    const response = await fetch(url, {<br>      headers: { <br>        Authorization: `Bearer ${process.env.API_KEY}`,<br>        &#39;Content-Type&#39;: &#39;application/json&#39;<br>      }<br>    });<br><br>    const data = await response.json();<br>    if (response.ok) {<br>      return res.json({ subscriptionId: data?.data?.subscription_id || null });<br>    }<br><br>    return res.status(response.status).json({ error: &#39;Failed&#39;, details: data });<br>  } catch (err) {<br>    console.error(err);<br>    res.status(500).json({ error: &#39;Internal error&#39; });<br>  }<br>};</pre><h4>Set environment variables:</h4><pre>BASE_URL : https://sandbox-api.paddle.com<br>API_KEY: your-api-key</pre><p>This is the cloud function for getting the subscription ID. After that, you would call the function to cancel the subscription.</p><pre>Future&lt;Map&lt;String, dynamic&gt;&gt; cancelSubscription(String subscriptionId) async {<br>    const String cancelUrl =<br>        &quot;https://cancel-subscription-562134412429.europe-west1.run.app&quot;;<br>    try {<br>      final response = await http.post(<br>        Uri.parse(&quot;$cancelUrl?subscriptionId=$subscriptionId&quot;),<br>      );<br><br>      if (response.statusCode == 200) {<br>        final body = jsonDecode(response.body);<br>        return body[&#39;data&#39;] as Map&lt;String, dynamic&gt;;<br>      } else {<br>        throw Exception(<br>            &#39;❌ Failed to cancel subscription: ${response.statusCode} ${response.body}&#39;);<br>      }<br>    } catch (e) {<br>      throw Exception(&quot;⚠️ Exception during cancelSubscription: $e&quot;);<br>    }<br>  }</pre><p>This would cancel the subscription. I also wrote the cloud function for it due to the CORS issue. You can follow the steps above. This is code for the cloud function.</p><pre>const fetch = require(&#39;node-fetch&#39;);<br><br>exports.cancelSubscription = async (req, res) =&gt; {<br>      // Always set CORS headers<br>  res.set(&#39;Access-Control-Allow-Origin&#39;, &#39;*&#39;);<br>  res.set(&#39;Access-Control-Allow-Methods&#39;, &#39;GET, POST, OPTIONS&#39;);<br>  res.set(&#39;Access-Control-Allow-Headers&#39;, &#39;Content-Type&#39;);<br><br>  // Handle CORS preflight request<br>  if (req.method === &#39;OPTIONS&#39;) {<br>    return res.status(204).send(&#39;&#39;);<br>  }<br>  try {<br>    const subscriptionId = req.query.subscriptionId || req.body.subscriptionId;<br>    console.log(&quot;📥 Incoming request:&quot;, {<br>      method: req.method,<br>      query: req.query,<br>      body: req.body,<br>      subscriptionId,<br>    });<br>    if (!subscriptionId) {<br>      return res.status(400).json({ error: &#39;Missing subscriptionId&#39; });<br>    }<br><br>    const url = `${process.env.BASE_URL}/subscriptions/${subscriptionId}/cancel`;<br>    console.log(`➡️ Sending request to: ${url}`);<br>    const response = await fetch(url, {<br>      method: &#39;POST&#39;,<br>      headers: {<br>        Authorization: `Bearer ${process.env.API_KEY}`,<br>        &#39;Content-Type&#39;: &#39;application/json&#39;<br>      }<br>    });<br><br>    console.log(&quot;External API response status:&quot;, response.status);<br><br>    const data = await response.json();<br><br>    console.log(&quot;External API response body:&quot;, data);<br><br>    if (response.ok) {<br>       console.log(&quot;Subscription cancellation successful&quot;);  <br>      return res.json({ data });<br>    } else {<br>      return res.status(response.status).json({ error: &#39;Failed&#39;, details: data });<br>    }<br>  } catch (err) {<br>    console.error(&quot;Internal server error:&quot;, err);<br>    res.status(500).json({ error: &#39;Internal error&#39; });<br>  }<br>};</pre><h4>Set environment variables:</h4><pre>BASE_URL : https://sandbox-api.paddle.com<br>API_KEY: your-api-key</pre><p>After that, you can just navigate to the home page or any other page you want.</p><p>So, this is a function for completely handling the cancellation of the subscription.</p><pre>Future&lt;void&gt; handleCancelByTransaction(<br>    String transactionId,<br>    BuildContext cancelContext,<br>  ) async {<br>    try {<br>      // Step 1: Get subscriptionId<br>      final subscriptionId = await getSubscriptionId(transactionId);<br><br>      if (subscriptionId == null) {<br>        throw Exception(<br>            &quot;No subscription found for transactionId: $transactionId&quot;);<br>      }<br><br>      // Step 2: Cancel subscription<br>      final result = await cancelSubscription(subscriptionId);<br>      // Here you can write your logic to update the backend that user <br>      // has cancel the plan<br>      Navigator.push(<br>        cancelContext,<br>        MaterialPageRoute(<br>          builder: (context) =&gt; const HomePageWidget(),<br>        ),<br>      );<br>    } catch (e) {<br>      rethrow;<br>    }<br>  }</pre><p>By using Paddle, you’re offloading a lot of complexity, tax handling, subscription billing, and checkout flow, so you can focus on building your product. 🎯</p><h4>How to Test Locally:</h4><p>If you wanna test your project by running locally first, so you can run the Python server as I do to test it, as paddle purchase will not run on Flutter local run on Chrome. I write this <strong>server.js</strong> file:</p><pre>const express = require(&#39;express&#39;);<br>const path = require(&#39;path&#39;);<br><br>const app = express();<br><br>// Add CSP header so Paddle iframe works<br>app.use((req, res, next) =&gt; {<br>  res.setHeader(<br>    &quot;Content-Security-Policy&quot;,<br>    &quot;frame-ancestors &#39;self&#39; http://localhost:* https://buy.paddle.com&quot;<br>  );<br>  next();<br>});<br><br>// Serve Flutter Web files<br>app.use(express.static(path.join(__dirname, &#39;build&#39;, &#39;web&#39;)));<br><br>// SPA fallback for all non-file routes<br>app.get(&#39;/*&#39;, (req, res) =&gt; {<br>  res.sendFile(path.join(__dirname, &#39;build&#39;, &#39;web&#39;, &#39;index.html&#39;));<br>});<br><br>const PORT = 8080;<br>app.listen(PORT, () =&gt; {<br>  console.log(`🚀 Server running at http://localhost:${PORT}`);<br>});</pre><p>You have to put it in your root of the project just like this, as shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*CO0csVeKosiYCQqrG0mWmg.png" /></figure><p>Now open the terminal and go to the path of your project and run these commands:</p><pre>flutter build web</pre><p>This will create a new directory inside the build folder that will be used when we run this web. This is the necessary step. Then type this:</p><pre>node server.js</pre><p>It will start the local server at port 8080; you will see this message on the terminal.</p><p>🚀 Server running at <a href="http://localhost:8080/">http://localhost:8080</a></p><p>And then just go to Chrome and launch this URL, and your website will be there. Here you can test your website. <a href="http://localhost:8080/"><strong><em>http://localhost:8080/</em></strong></a></p><blockquote>Now it’s your turn: hook this into your project, test some payments, and launch your SaaS with a fully working payment system.<br>So when you are done with testing so don’t forget to change your live key and also the live base URL that is this: <a href="https://api.paddle.com/">https://api.paddle.com</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*8I8JeTVKHkZWYN0N8f8fmA.png" /></figure><p>After doing this, you might have to send your site for the business approval to Paddle, where Paddle will view your business and then approve it after their procedures. You can read the article for further clarification about it.</p><p><a href="https://www.paddle.com/help/start/account-verification">Account Verification - Help Center - Paddle</a></p><p>Here you will find the way to verify your business and domain, and your identity verification. This marks the end of this a bit-long, knowledgeable article. 😅 If I miss something and you face any difficulty while integrating it so don’t hesitate to reach out.</p><p>You can find me on LinkedIn. Click on the logo:</p><figure><a href="https://www.linkedin.com/in/affan-minhas/"><img alt="https://www.linkedin.com/in/affan-minhas/" src="https://cdn-images-1.medium.com/proxy/1*jN9OKUho03-qbwzoRSu0BQ.jpeg" /></a></figure><p>If you like this article and want more articles like this, please show support for me.</p><figure><a href="https://buymeacoffee.com/affansulta8"><img alt="https://buymeacoffee.com/affansulta8" src="https://cdn-images-1.medium.com/proxy/1*3BFiSb2mC7FcJLye94-0Wg.png" /></a></figure><p>#Flutter #FlutterWeb #MobileDevelopment #AppDevelopment #CrossPlatform #DevCommunity #Paddle #SaaS #SaaSDevelopment #PaymentIntegration #Subscriptions #PaymentGateway #IndieHacker #Startups #BuildInPublic #SaaSFounder</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8fa1a2a51ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/how-to-integrate-paddle-payments-in-flutter-web-2025-a8fa1a2a51ef">How to Integrate Paddle Payments in Flutter Web — 2025</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering CI/CD: Automating Flutter Builds with GitHub Actions for Beginners]]></title>
            <link>https://medium.com/blocship/mastering-ci-cd-automating-flutter-builds-with-github-actions-for-beginners-b6d438251ff7?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6d438251ff7</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[continous-deployment]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 07:50:33 GMT</pubDate>
            <atom:updated>2025-04-02T07:56:16.414Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you’re working on a Flutter project, and every time you push your code, you have to build your app for Android and iOS manually. It’s time-consuming and frustrating, right? What if I told you that you can automate the entire process so your app is built and even released without lifting a finger? 🤯</p><p>This is where <strong>GitHub Actions</strong> comes into play! 😎</p><p>GitHub Actions allows you to set up workflows that automatically build, test, and even deploy your Flutter apps whenever changes are made to your repository. In this guide, I’ll break everything down in simple steps, as if I were explaining it to a 5-year-old. 👶</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3_ra_yjdO4j_TgQk-Bqogg.png" /></figure><h3>What is GitHub Actions?</h3><p>GitHub Actions is an automation tool provided by GitHub that helps you execute tasks based on triggers, like when you push code to your repository. Think of it like a robot that follows instructions without making mistakes. 🤖</p><p>With GitHub Actions, we can:</p><ul><li>Automatically build our Flutter project 🏗️</li><li>Generate APKs and IPA files 📱</li><li>Upload the build files to GitHub Releases 📤</li></ul><p>All of this happens automatically when we push code or create a pull request. Cool, right? 😎</p><h3>Setting Up GitHub Actions for Flutter</h3><p>Before we start, let’s make sure you have everything ready. 🛠️</p><h4>Prerequisites</h4><ol><li><strong>A GitHub Repository: </strong>You must have your Flutter project stored on GitHub.</li><li><strong>Basic Knowledge of YAML</strong>: Don’t worry, I’ll explain everything about it!</li><li><strong>A GitHub Personal Access Token: </strong>This is needed to push build artifacts to GitHub Releases.</li><li><strong>Flutter Installed Locally: </strong>Helps you test the build before automating it.</li></ol><p>If you have these ready, let’s jump in! 🥳</p><h3>Step 1: Creating the Workflow File</h3><p>In your Flutter project, navigate to .github/workflows/ and create a new file called flutter-ci.yml (you can name it anything, but this is a good convention).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*gwRWfbdk_Z8r9VnINwK0Tw.png" /></figure><p>📌 <strong>What is YAML?</strong> YAML (Yet Another Markup Language) is a simple way to write configuration files. It’s like giving instructions to a robot in an easy-to-read format.</p><p>Now, let’s start writing our YAML file. 📝</p><blockquote><strong>Note:</strong> I will break down the code of the file into small parts, and the final code will be attached at the end. Please read it completely to better understand, or you can copy the code from the end.</blockquote><h3>Step 2: Defining the Workflow Triggers</h3><p>At the top of the YAML file, we define when the workflow should run.</p><pre>on:<br>  pull_request:<br>    branches:<br>      - main<br>      - master<br>  push:<br>    branches:<br>      - main<br>      - master<br>      - develop<br>      - ui/auth</pre><p>📌 <strong>Explanation:</strong></p><ul><li>This means that the workflow will run whenever we push to or create a pull request on main, master, develop, or ui/auth branches.</li><li>ui/auth is a branch I created for the specific purpose. Like this, you can create and write it here so that it can be a part of it.</li></ul><h3>Step 3: Naming Our Workflow and Defining the Job</h3><pre>name: &quot;Build &amp; Release&quot;<br><br>jobs:<br>  build:<br>    name: Build &amp; Release<br>    runs-on: macos-latest</pre><p>📌 <strong>Explanation:</strong></p><ul><li>We named our workflow <strong>Build &amp; Release</strong>.</li><li>Under jobsWe define a job named <strong>build</strong>.</li><li>It runs on macos-latest because we need a Mac environment for iOS builds. (GitHub Actions run on GitHub’s servers, so don’t be confused by this word <strong>macos-latest</strong> if you are on Windows).</li></ul><h3>Step 4: Check out the Repository</h3><pre>    steps:<br>      - uses: actions/checkout@v3</pre><p>📌 <strong>Why is this needed?</strong></p><ul><li>This step pulls our Flutter project from GitHub so the workflow can access it.</li></ul><h3>Step 5: Setting Up Java</h3><pre>      - uses: actions/setup-java@v3<br>        with:<br>          distribution: &#39;zulu&#39;<br>          java-version: &#39;17&#39;</pre><p>📌 <strong>Why Java?</strong></p><ul><li>Flutter requires Java for Android builds.</li><li>We use Zulu distribution and version 17 because version 12 is not supported!</li></ul><h3>Step 6: Setting Up Flutter</h3><pre>      - uses: subosito/flutter-action@v2<br>        with:<br>          channel: &#39;stable&#39;<br>          architecture: x64</pre><p>📌 <strong>Why this step?</strong></p><ul><li>It installs Flutter so our project can be built.</li><li>We use the stable channel to ensure reliability.</li></ul><h3>Step 7: Building the Android and iOS Apps</h3><pre> - run: flutter build apk --release --split-per-abi</pre><p>📌 <strong>Explanation:</strong></p><ul><li>This command builds the Android app in <strong>release mode</strong>, splitting APKs per ABI (device architecture).</li></ul><p>For iOS:</p><pre>      - run: |<br>          flutter build ios --no-codesign<br>          cd build/ios/iphoneos<br>          mkdir Payload<br>          cd Payload<br>          ln -s ../Runner.app<br>          cd ..<br>          zip -r app.ipa Payload</pre><p>📌 <strong>Explanation:</strong></p><ul><li>The flutter build ios --no-codesign command builds the iOS app without code signing.</li><li>We package the .ipa file for distribution.</li></ul><h3>Step 8: Uploading to GitHub Releases</h3><pre>      - name: Push to Releases<br>        uses: ncipollo/release-action@v1<br>        with:<br>          artifacts: &quot;build/app/outputs/apk/release/*,build/ios/iphoneos/app.ipa&quot;<br>          tag: v1.0.${{ github.run_number }}<br>          token: ${{ secrets.TOKEN }}</pre><p>📌 <strong>Explanation:</strong></p><ul><li>This step uploads our APK and IPA files to GitHub Releases.</li><li>The tag is set dynamically using the GitHub run number.</li><li>We use a <strong>GitHub Secret (</strong><strong>TOKEN)</strong> to authenticate and push the release. I explain how to generate the Token and save it on the next step.</li></ul><p>Final Code:</p><pre>on:<br>  pull_request:<br>    branches:<br>      - main<br>      - master<br>  push:<br>    branches:<br>      - main<br>      - master<br>      - develop<br>      - ui/auth<br>name: &quot;Build &amp; Release&quot;<br>jobs:<br>  build:<br>    name: Build &amp; Release<br>    runs-on: macos-latest<br>    steps:<br>      - uses: actions/checkout@v3<br>      - uses: actions/setup-java@v3<br>        with:<br>          distribution: &#39;zulu&#39;<br>          java-version: &#39;17&#39;<br>      - uses: subosito/flutter-action@v2<br>        with:<br>          channel: &#39;stable&#39;<br>          architecture: x64<br><br>      - run: flutter build apk --release --split-per-abi<br>      - run: |<br>          flutter build ios --no-codesign<br>          cd build/ios/iphoneos<br>          mkdir Payload<br>          cd Payload<br>          ln -s ../Runner.app<br>          cd ..<br>          zip -r app.ipa Payload<br>      - name: Push to Releases<br>        uses: ncipollo/release-action@v1<br>        with:<br>          artifacts: &quot;build/app/outputs/apk/release/*,build/ios/iphoneos/app.ipa&quot;<br>          tag: v1.0.${{ github.run_number }}<br>          token: ${{ secrets.TOKEN }}</pre><h3>Step 9: Adding Secrets in GitHub</h3><ol><li>Go to your GitHub repository for which we wrote the github folder above.</li><li>Navigate to Settings &gt; Secrets and Variables &gt; Actions.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-i-MFNNQEdwYjhHB_Em-vQ.png" /></figure><p>Now, before creating it, you must have your personal access token. In order to create the new token, follow these steps. Go to your GitHub profile and then navigate to settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*CSbvIdMaOmwqlPNyrBt1iw.png" /></figure><p>Then navigate to developer settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*Y5RKuC_1p8KU3LVZXP6fmg.png" /></figure><p>Then navigate to Tokens (classic).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*ftOWF5WgO_vxJhrOiE9uew.png" /></figure><p>Then generate a new token (classic).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8q48O-bderQvM2A50YTOnA.png" /></figure><p>Then provide some info as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xp_sB-i517932TIkYlNSeA.png" /></figure><p>Then hit the generate to complete it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*5JZYGLK4OH-6POsS8pb8Nw.png" /></figure><p>After that, you will see the token, so copy it and get back to step 02 above.</p><p>3. Now you need to generate a new repository secret here. Click New repository secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EfJpOVlpHInHyVdyWx9tPw.png" /></figure><p>4. Name it TOKEN and paste your <strong>GitHub Personal Access Token</strong>. which you recently generated and copied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UpGgRdj0gA8gq-WhmGgwHw.png" /></figure><p>Now it’s done and configured successfully! You just need to push your code from your IDE or code editor. Make sure the branch is correct that you put in the workflow file, and then the process will start on your GitHub repository as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ogfHeUXknQcR2GJecVZ2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQGfzyJctkx2-1_Z7026RA.png" /></figure><p>Once it’s successful, you will see the green check and which means the APK is generated successfully, and you will see all these steps are done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yu_GSy4C89ZT6nFXrxOR3Q.png" /></figure><p>Then just come back to the main code tab and you will see the build there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hi3KdFIIFh8VrNhoR-776g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JCsUh6xjXSZA27DeHUrPg.png" /></figure><p>Now, you can tell your QA guy to just download it here.</p><h3>Final Thoughts: The Power of Automation</h3><p>Congratulations! 🎉 You have successfully automated the Flutter build process using GitHub Actions. Now, every time you push changes, your app will be built and uploaded automatically. No more manual work!</p><p>Give this workflow a try and let me know how it works for you! 😊 <strong>Have questions or improvements? Drop them in the comments! </strong>💬</p><p>You can find me on LinkedIn. Click on the logo:</p><figure><a href="https://www.linkedin.com/in/affan-minhas/"><img alt="" src="https://cdn-images-1.medium.com/max/275/1*jN9OKUho03-qbwzoRSu0BQ.jpeg" /></a></figure><p>If you like this article and want more articles like this, please show support for me.</p><figure><a href="https://buymeacoffee.com/affansulta8"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3BFiSb2mC7FcJLye94-0Wg.png" /></a></figure><p>#GitHubActions #CICD #DevOps #Automation #ContinuousIntegration #Flutter #FlutterDev #MobileAppDevelopment #AndroidDevelopment #FlutterCommunity</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6d438251ff7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/mastering-ci-cd-automating-flutter-builds-with-github-actions-for-beginners-b6d438251ff7">Mastering CI/CD: Automating Flutter Builds with GitHub Actions for Beginners</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In-App Purchases With Revenue Cat Flutter — 2025]]></title>
            <link>https://medium.com/blocship/in-app-purchases-with-revenue-cat-flutter-2025-36adbef2c2d5?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/36adbef2c2d5</guid>
            <category><![CDATA[revenuecat]]></category>
            <category><![CDATA[in-app-purchase]]></category>
            <category><![CDATA[app-store]]></category>
            <category><![CDATA[google-play]]></category>
            <category><![CDATA[flutter-revenuecat]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Tue, 25 Mar 2025 16:36:43 GMT</pubDate>
            <atom:updated>2025-03-25T16:38:16.249Z</atom:updated>
            <content:encoded><![CDATA[<h3>In-App Purchases With Revenue Cat Flutter — 2025</h3><h3>Introduction</h3><p>So, you’ve built an amazing Flutter app, and now it’s time to <strong>monetize</strong> it? Whether you’re adding subscriptions, one-time purchases, or consumable purchases, <strong>RevenueCat</strong> makes integrating in-app purchases (IAPs) painlessly without dealing with the complexities of Apple and Google’s billing systems.</p><p>Forget about manually handling purchase receipts, subscriptions, or user entitlements. With <strong>RevenueCat</strong>, you get a single interface to manage everything effortlessly.</p><p>In this guide, I’ll walk you through <strong>the steps</strong> to integrate RevenueCat into your Flutter app and start making money easily!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXye0-BHaI2wfWm5x4oakA.png" /></figure><h3>Setting Up RevenueCat Account</h3><p>Before diving into the Flutter code, you need to create an account on <a href="https://www.revenuecat.com/"><strong>RevenueCat</strong></a> and set up your project.</p><ol><li>Go to <strong>RevenueCat’s Dashboard</strong> and sign up.</li><li>Create a <strong>new project</strong> and set up an <strong>App Store</strong> and <strong>Google Play</strong> integration.</li><li>Configure your <strong>Products</strong> (subscriptions, consumables, or non-consumables).</li><li>Save the <strong>API keys</strong> — we’ll need them soon!</li></ol><pre>In the context of in-app purchases, a consumable product is one that a user <br>can buy and use multiple times, like in-game currency or temporary boosts, <br>while a non-consumable product is a one-time purchase that provides <br>permanent access or unlocks content, like a permanent feature or a <br>specific item. </pre><p>📝 Important Note:</p><p>RevenueCat acts as a middleman between your app and Apple/Google, handling subscription management, status changes, and user entitlements. This means <strong>less headache</strong> for you. 😉</p><h3>Setup</h3><p>Now let’s start integrating. Go to your revenue cat dashboard and start creating a project if you haven’t created one yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOVfhF9ZcI5DXFAmZowBnA.png" /></figure><p>After that, just provide a name to your project and hit create project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RrgUikwvLCjcWq5z6K_aUQ.png" /></figure><p>Now it’s time to add your app here. First go with Android.</p><h3>Android Setup</h3><p>Click on Google Play Store to add the Android app here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RS7NUiet9v-o6ywNMOiHYg.png" /></figure><p>Now you need to provide the package identifier of your app and service account credentials to communicate it here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FLfubm4IZU3WPU-U-G3r8A.png" /></figure><p><strong>Google Play Package:</strong> You can find it in your Flutter app. Image attached where you can find that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*weRo9i7hRRRL-5B6-vIzQA.png" /></figure><p><strong>Service Account Credentials JSON: </strong>This is the file that needs to be set up so that revenue cat can communicate with our Google Play Console.</p><p>You can also follow this article on how to set it.</p><p><em>https://www.revenuecat.com/docs/service-credentials/creating-play-service-credentials</em></p><p>Let me mention the steps in short, so that you can also do with me or follow the article above.</p><h4>Step 01: Enable the Google Developer and Reporting API</h4><p>Go to the <a href="https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com">Google Play Android Developer API page</a> and the <a href="https://console.cloud.google.com/apis/library/playdeveloperreporting.googleapis.com">Google Play Developer Reporting API page</a> in Google Cloud Console.</p><p>Just click on it and it will let you there. Make sure the right project is selected there. If you don’t have any project, create a new project named with your Flutter project and then enable API’s on it. We will be using that cloud project to configure our purchases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4_HRCVqXXcy76Q7m0wuScQ.png" /></figure><p>Follow this to enable both API’s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kyDFqgmKpfSrT5_O-9J9lQ.gif" /></figure><h4>Step 02: Create a Service Account</h4><p>Go with this link: <a href="https://console.cloud.google.com/">Cloud Console</a> ➡️ <a href="https://console.cloud.google.com/iam-admin">IAM &amp; Admin</a> ➡️ <a href="https://console.cloud.google.com/iam-admin/serviceaccounts">Service Account</a></p><p>If you have multiple projects, so you will see this screen and select the project that you created for it. If not, then you have to create one as I said before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gCn0DXHzzd9MSQD2lxd_Ew.png" /></figure><h4>1. Create and name the service account key credentials and add roles.</h4><p>Follow this to do that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t2iq-okzM0IwNLoVL1iRqg.gif" /></figure><h4>2. Create and download the private key</h4><p>Follow this to do that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gnksnr0J2nkIGEAE2ENy_g.gif" /></figure><p>Save this file, we’ll use this in the revenue cat configuration.</p><h4>Step 03: Grant Financial Access to RevenueCat</h4><p>Now we need to give permission to this API key through our Google Play Console.</p><p>Prerequisite:</p><ul><li>You must have Google Play Console.</li><li>If you don’t have one, buy the Google Play Console account.</li></ul><p>Just follow this link and select your account, and you will have to go to users and permissions.</p><p><a href="https://play.google.com/console/u/0/developers/9185354573359080536/users-and-permissions">Google Play Console</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y39DCeCmpgx_NUoX4VzdpA.png" /></figure><p>Now you have to go back to the cloud console where we created the service account and copy that from there as shown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hMzSVqdZVxCN4qBmv75PLw.png" /></figure><p>Now click the invite user that I told you above, and add your app there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yTEmV7jcLOkmBy3Pc9gdMQ.png" /></figure><blockquote><strong>Note: </strong>If you don’t see any app there, you haven’t added it yet. To integrate in-app purchases, it is compulsory that your app must be deployed or in closed testing or any other testing. I have written a detailed article on how you can <a href="https://medium.com/blocship/publish-flutter-app-to-play-store-69cb0cd5a30b">publish your Flutter app</a>. Although I didn’t write an article on how to add it in closed testing, if you guys need so, do a comment then I will add that in detail.</blockquote><p>Now follow this to invite the user and give access to this key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDToy7YQrh4ktJ_ZxA1m6w.gif" /></figure><h4>Step 04: Enter the Credentials JSON in RevenueCat</h4><p>Now we need to add the credential downloaded into the revenue cat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DzyOpPisBKwHUkP4HsAozg.gif" /></figure><p>After that just hit the save.</p><h4>Check the status of your credentials</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nsr9063mi3Bc2Xfnvpqkyw.png" /></figure><blockquote>This is the step you need to understand correctly, that if you see there is no tick to valid credentials, so first you need to upload your app into the closed testing track of Google Play Console. Make sure it should be there. If you don’t know how to do that so please check any online resource or youtube video, if this doesn’t work let me know on comment so I will write an article for it also.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*aixXiOlY0g-pFvldWBlpBg.png" /></figure><p>Once your app is in closed testing, the last two will be checked, but the first will not be checked. For that you have to wait because Google takes some time to make it validated. The time can go up to 36 hours, but most of the time it’s validated in 24 hours.</p><p>Once all is validated, the revenue cat is set up correctly for Android.</p><h3>iOS Setup</h3><p>Click on the App Store to add the iOS app here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFtOHmSMxv_Eh7aQm-C2rQ.png" /></figure><p>Now just add your bundle identifier, the same as we did for Android. For the key we have to follow some steps to generate it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P52H3qMO09DMVZz8QptnDw.png" /></figure><h4>In-App Purchase Key Configuration</h4><h4>Step 01: Generating an In-App Purchase Key</h4><p>In-app purchase keys are generated in App Store Connect under <strong>Users and Access → Integrations → In-App Purchase</strong>. The same key can be used for all App Store apps associated with the same App Store Connect account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fedx8ShYkcTjNLKLLEnsXQ.png" /></figure><blockquote>Note: If you don’t see the <strong>In-App Purchase </strong>tab there, you need to be an admin and account holder of App Store Connect. You can ask your client to give the account access or guide him to do this step for you.</blockquote><p>Click <strong>Generate In-App Purchase Key</strong>, or if you’ve previously created one, click the <strong>“+”</strong> symbol next to the <strong>Active</strong> header. You’ll then be prompted to enter a name for the key.</p><p>Once generated, the key will appear under <strong>Active Keys</strong>, and you’ll have only one opportunity to download it.</p><p>Click the <strong>Download API Key</strong> and store the file securely. In the next step, you’ll need to upload it to RevenueCat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EvZ09E-zV5rDvXo52_ZI-Q.png" /></figure><h4>Step 02: Uploading the In-App Purchase Key to RevenueCat</h4><p>After setting up everything in App Store Connect, upload the In-App Purchase Key from the previous step to RevenueCat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFd3_kc9N1HEWMVN4bT8mg.png" /></figure><h4>Step 03: Providing the Issuer ID to RevenueCat</h4><p>Now you need to provide the issuer ID for that just go back to step 01 where you generated the key and there you find the Issuer ID. Just copy and paste it here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_AxH09mamCizMcENzm17PA.png" /></figure><p>Don’t forget to hit the save changes on the Revenue cat after doing these steps.</p><h4>Check the status of your credentials</h4><p>After doing all steps check the status of the credentials. Click on validate credentials to see the status. It should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*sFJkiThNfkD39WY4_9lzRA.png" /></figure><p>If you have trouble with this point do mention with point you got issue.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FpK4JVcqh68lIo2dJ0V%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FpK4JVcqh68lIo2dJ0V%2Fgiphy.gif%3Fcid%3Decf05e47jvm2zqz7vvrcmagnmzwzh99jfmtzezfmg7vz2rec%26ep%3Dv1_gifs_related%26rid%3Dgiphy.gif%26ct%3Dg&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbDVmb2c5bXV0cHk5Nnd0dTB5aXpuZnpjdjd5aHBxenZiMnJsZnFhayZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FpK4JVcqh68lIo2dJ0V%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/841576ec1205c7404c46dd38f05ca9d8/href">https://medium.com/media/841576ec1205c7404c46dd38f05ca9d8/href</a></iframe><p>Now you have successfully set up the Android and iOS configuration for on RevenueCat. Let&#39;s move to add the plans on Google Play and App store connect.</p><h4>Android Google Play Subscription Setup:</h4><p>Now open your Google Play developer console and navigate to the subscription section to add the subscription details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-tc7iXFcz3OtTwMrO6blw.png" /></figure><p>Then click on Create Subscription to add a new subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-zhRt8CMVgL6dgfbnYtTCA.png" /></figure><p>Now provide these details according to your app name or category that you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T0S3eQmysqv3K8AcGtMkIw.png" /></figure><p>Now there are some steps listed that need to be completed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IiOmEVeEYLk7rdqRbfny1A.png" /></figure><p>Let’s go one by one and complete these all:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Ney8W7I3USaCqfcbHz1rw.png" /></figure><p>Provide these details according to your app&#39;s purpose. It depends on what premium service are you offering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DIKFA6xD5qIbpBAaCgW0fw.png" /></figure><p>Now you need to provide the tax information regarding your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v47av2u9jw8W1GOTDe0kNQ.png" /></figure><p>If you want to restrict your payment to some regions you can tell Google to do so. After that just hit save changes to save all the settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8N7ztkk_9wTUGZGZoWXfWw.png" /></figure><p>Now get back and do step 2 to set the base plan for your subscription.</p><blockquote>A base plan specifies the core characteristics of a subscription, such as the duration of the subscription (e.g., monthly, yearly) and whether it automatically renews or requires a manual purchase to continue. Base plans are the foundation for offering subscriptions in your app, and users always purchase a base plan to obtain subscription access.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Z6e42Dsqgpipi1fEOzDNw.png" /></figure><p>Then provide the necessary details according to your subscription type. I am going with Auto-renewing but you must choose according to what you wanna provide. Also fill tags regarding your application type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJzj4vCDpDPN-lARME_x9A.png" /></figure><p>Then fill in the details according to what you wanna provide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*69r-GnCVK5ebg_ehwyhQQw.png" /></figure><p>Now you will need to set the price for your base plan. Just click on the set price for all the regions your app would be available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAu1yFpvaSbmkraad3HvRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*59JiGpxzA6YurtQ6riaXoA.png" /></figure><p>Now set the price for your plan you wanna offer to users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*kw8-6jGXnDPbLfutBCEfaw.png" /></figure><blockquote>Sometimes you offer a special discount to any region. Let’s say you wanna provide the 10% discount to specific region like UK so can explicitly set the price for that particular region so when user try to purchase on that region they will get the price with 10% discount.</blockquote><p>After setting the price click on edit to that specific region and set the price for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eyOM0JQL1weL2V2iI2IHsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uh8UI8IIpHQ5JYH4dT-_gQ.png" /></figure><p>Now hit save finally to create your base plan successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFYLbaqfcgjO9_-EIOglPQ.png" /></figure><p>After that hit <strong>Activate</strong> to activate this plan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-UtRo7HbymEgGjPjDm34Q.png" /></figure><p>In this way, your base plan will be activated, and now go back and you will see your plan is live now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*au9AHsN1im0e7Eqe2VelQA.png" /></figure><p>Now we need to create the offers for the base plan that will show what type of premium access you will be providing. So click on add offer as you can see on the above image.</p><p>Then you will see the base plan would be automatically selected so just click on Add offer to move forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kKEU59vR7d5Qidktu3tfkQ.png" /></figure><p>Then provide the details accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INXz_Pwuvd9PEDNtaEgr8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhWgYBJ5DSSFBA49HlgOog.png" /></figure><p>After that you have to add the phase for your offer. Again I am doing a single payment but you can do what you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qwvx41WEWc3nnyWJ6_8raQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJI8aWFI4cGM4K7PnDqpJw.png" /></figure><p>Now you can choose what type of discount you wanna provide the user. It could be a fixed amount, any percentage, or anything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8IE0HdoCQi8sP6EWPLCkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CeTIGn0U57Z9T4hLaakzBA.png" /></figure><p>Now set the discount you wanna provide on your base plan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*mC5Lm7TGUdUPntWCobxH-g.png" /></figure><p>Then hit save and then hit activate to make it live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rV9_29shD4l7pRTO_XAJ9g.png" /></figure><p>Now your offer will also be live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnZ7of1j3PZ93dAfsp2GrA.png" /></figure><p>We have successfully configured our subscription on Google Play Console.</p><h4>Import This Product Into the RevenueCat Dashboard:</h4><p>Now just to your revenue cat dashboard and import this product there by the following steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5ilBv_cYlqD9OzTJFKtlA.png" /></figure><p>Then click on import</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cmVTc6n0CpHustQxPRaIcw.png" /></figure><p>Then you will see the subscription that you have created on Google Play recently. Make sure the status should be active so we can use that. Then click on import to get it here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*80vZ7qGQ4c7s2CpKvSngRA.png" /></figure><p>Then you would see it’s imported and should show the status as published.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UIoVmqWCezBdgrAbwG6atw.png" /></figure><p>Now you need to attach the entitlement but before that, you have to create one. For that just go to the entitlement section and hit the new button.</p><blockquote><strong>RevenueCat Entitlements</strong> represent a level of access, features, or content that a user is “entitled” to. Entitlements are scoped to a project and are typically unlocked after a user purchases a product.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yuoHBL5EVo-dtDY_oK240w.png" /></figure><p>Now provide the necessary details for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_JJzrsXTLOGarkY5OHuiA.png" /></figure><p>Then go back to the product you created and then you can attach an entitlement to that now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9TMxFuhi1wexc--fpjoHHg.png" /></figure><p>Then hit attach to make it successfully attached.</p><p>In this way your product is successfully configured and active. Now we will move forward with offerings and packages. But before that let’s understand it first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qi5YxqFi46SOJ-mdd_ba0A.png" /></figure><p>This chart shows how revenue cat works. We have created out entitlement and also attached the product to that. Now we will create the packages and add offerings with this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QOuRdP6o1HISZWE65ro0Vw.png" /></figure><p>Then create a package inside the offering and you will see the product also while creating your package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzcEbHBB7uhDCFbtvEKV3Q.png" /></figure><p>So in this way, you would have your offering ready to display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r8nNWE7g0KtoDqvlDPehxg.png" /></figure><h4>iOS App Store Subscription Setup:</h4><p>Login to your app store connect account.</p><p><a href="https://appstoreconnect.apple.com/apps">https://appstoreconnect.apple.com/apps</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*Alafz3XoQ3fbRwx3mSKykQ.png" /></figure><p>Then select the app you have created already.</p><blockquote>If you didn’t have any app created yet so create one by clicking on the plus icon. You can also follow this link to create that.</blockquote><blockquote><a href="https://developer.apple.com/help/app-store-connect/create-an-app-record/add-a-new-app/">https://developer.apple.com/help/app-store-connect/create-an-app-record/add-a-new-app/</a></blockquote><p>Select your app now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLTjrSclxXu4LhpgN9iE9w.png" /></figure><p>Then go to the subscription tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aLewSzWiuai_H3T-RLZv8A.png" /></figure><blockquote>If the <strong>Subscriptions</strong> option is missing, ensure your developer account has accepted all applicable contracts and provided tax and banking details in the <strong>Agreements, Tax, and Banking</strong> section of App Store Connect.</blockquote><blockquote>Completing all agreements, tax forms, and banking information is necessary to proceed with this guide.</blockquote><p>Then create a subscription group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PVsW7wR_jsarwlBtiluZgg.png" /></figure><p>Named your subscription group what you want. Prefer to be named according to your app name or something.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g4wGgDPdbhmaHt9V7PERAg.png" /></figure><p>After that, you need to create a subscription to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_gzBzYO_JpZorrBlxNXqHQ.png" /></figure><p>Provide the details of the reference name and product ID. To create a product ID please follow this format:</p><pre>&lt;app&gt;_&lt;price&gt;_&lt;duration&gt;_&lt;intro duration&gt;&lt;intro price&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQbsj0mVTo5yyd8QIMf-6Q.png" /></figure><p>After that set the duration of your plan and hit the save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SmsZOSQ9lSYwN1CpXmbYXQ.png" /></figure><h4>Adding Availability</h4><p>After that set the availability of your subscription across the regions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CuQYuQeXaccV3Pf5ExFU6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uajDKK6vzbuO6XGgSFuAAg.png" /></figure><h4>Adding Price</h4><p>After that set the pricing for the subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sTBlmh0aJRjSE-5w5xwjxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBmLMguCUoykuPBApxPlrQ.png" /></figure><p>Apple will automatically convert this amount into local currency for every country from which will buy your subscription.</p><p>If you wanna add different prices across the region you can also set it there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYfk-_UwRkopF53oNcjhYg.png" /></figure><p>Then click next and confirm it and don’t forget to hit save after every setting here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-Q_VDUdRJq5MNpcoz_u3w.png" /></figure><h4>Adding Introductory Offers and Free Trials</h4><p>If you wanna add any introductory offers you can set them up from here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QB4pker6CXY1dmiZjkpI9Q.png" /></figure><p>Then select a country and region where this introductory offer will be displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-lPJOHu5VYzTHQe3tebkA.png" /></figure><p>After that select the type of this introductory offer. You can go with any offer you want. I am giving the first week free so going with free as an introductory offer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqeZYWZ4QTWBhTF8r-D3Bg.png" /></figure><p>Then hit confirm to save it. You will see your all introductory offers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3KsYmtzwFGbHOQoD8n91OA.png" /></figure><h4>Adding Localization</h4><p>The next step is to set up localization for the App Store, which includes the name and description of the in-app purchases that users will see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zYVQBleWZ9AWqCoEwTyA4w.png" /></figure><h4>Add Reviewer Information</h4><p>The final step in setting up an in-app purchase on iOS is providing information for the reviewer. This includes a <strong>screenshot</strong> and optional <strong>review notes</strong>.</p><p>Many developers overlook the screenshot, but it’s required, you won’t be able to submit your product for review without it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzEG6v9O0xRQ8IdPDOsqBQ.png" /></figure><p>Choose the UI where you are displaying your subscription sheet and write notes about it just like I did.</p><p>After these, you have successfully added your subscription details to App Store Connect. Now we will move to importing this into Revenue Cat.</p><h4>Import This Product Into the RevenueCat Dashboard:</h4><p>Navigate to your RevenueCat dashboard products section.</p><p><a href="https://app.revenuecat.com/projects/64c951f9/products">RevenueCat</a></p><p>Then select the products tab from the left menu bar and then click on import for iOS products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_UNaRv5RlJ8LtRs98VZwQ.png" /></figure><p>Then you will use the product that you just created in the above steps. After that click on import to get this product here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U61mRf4UCC62ROVTFFFTIw.png" /></figure><p>Then you will see your product here and then we need to attach the entitlement to it. We have already created it so just click on attach to attach the entitlement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MLfnPxIAmBuwmvxnZaX8g.png" /></figure><p>Then select the entitlement we have created and hit attach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FA9c_ixf7fp9GzIOAe1qOA.png" /></figure><p>Now our app store product is also configured on RevenueCat.</p><p>You might be seeing the state as missing metadata because of localization. Navigate to your app store connect account go to the subscription section and add the localization for your subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ehxkDwCE3pYwMGLp5dYTSw.png" /></figure><p>Then provide the name of your subscription you wanna display to the user. Apple will translate it according to the language of the device when the user is using it. That’s how it works. You can also set the App name that will be displayed along with it. You can also customize it according to what you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YJ0Q_B5qFLkvPo_imxR9_A.png" /></figure><p>Now the status would be changed to Ready to submit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oec7HVkXBIeuQUuglA9fxQ.png" /></figure><p>So it means the subscription is ready and we are also done with app store configuration. If you face any difficulty till this step then do mention in the comment with the reference of the issue so I can improve it and also provide the solutions.</p><h3>Integrate RevenueCat into the Flutter App</h3><p>As we are done with configuration, we can move towards the implementation of it into our Flutter app.</p><p>Go to pub.dev and copy the package from there.</p><p><a href="https://pub.dev/packages/purchases_flutter">purchases_flutter | Flutter package</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7pOOjrb33MuWkkXl3iPasw.png" /></figure><p>After that paste this into your pubspec.yaml file in your Flutter app and run pub get.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wwNWlsG44rZLj9oQ6QvbtA.png" /></figure><p>I have written a utility file that will help us to use the revenue cat purchases function inside the app. Create a new dart file inside any folder, prefer naming it “<strong>revenue_cat_util.dart</strong>”</p><pre>import &#39;dart:io&#39; show Platform;<br>import &#39;package:purchases_flutter/purchases_flutter.dart&#39;;<br>import &#39;package:flutter/foundation.dart&#39; show kIsWeb;<br>import &#39;package:flutter/services.dart&#39;;<br><br>export &#39;package:purchases_flutter/purchases_flutter.dart&#39; show Package, Offering;<br><br>Offerings? _offerings;<br>CustomerInfo? _customerInfo;<br>String? _loggedInUid;<br><br>Offerings? get offerings =&gt; _offerings;<br><br>CustomerInfo? get customerInfo =&gt; _customerInfo;<br><br>set customerInfo(CustomerInfo? customerInfo) =&gt; _customerInfo = customerInfo;<br><br>Future initialize(<br>  String appStoreKey,<br>  String playStoreKey, {<br>  bool debugLogEnabled = false,<br>  bool loadDataAfterLaunch = false,<br>}) async {<br>  if (kIsWeb) {<br>    print(&#39;RevenueCat is not supported on web.&#39;);<br>    return;<br>  }<br>  try {<br>    if (Platform.isIOS) {<br>      await Purchases.setDebugLogsEnabled(debugLogEnabled);<br>      await Purchases.setup(appStoreKey);<br>    } else if (Platform.isAndroid) {<br>      await Purchases.setDebugLogsEnabled(debugLogEnabled);<br>      await Purchases.setup(playStoreKey);<br>    } else {<br>      print(&quot;RevenueCat is not supported on this platform.&quot;);<br>      return;<br>    }<br><br>    if (loadDataAfterLaunch) {<br>      loadCustomerInfo();<br>      loadOfferings();<br>    } else {<br>      await loadCustomerInfo();<br>      await loadOfferings();<br>    }<br><br>    Purchases.addCustomerInfoUpdateListener((info) {<br>      customerInfo = info;<br>    });<br>  } on Exception catch (e) {<br>    // This should happen only in the web run mode.<br>    print(&quot;RevenueCat initialization failed: $e&quot;);<br>  }<br>}<br><br>// Purchase a package.<br>Future&lt;bool&gt; purchasePackage(String package) async {<br>  try {<br>    final revenueCatPackage = offerings?.current?.getPackage(package);<br>    if (revenueCatPackage == null) {<br>      return false;<br>    }<br>    customerInfo = await Purchases.purchasePackage(revenueCatPackage);<br>    return true;<br>  } catch (_) {<br>    return false;<br>  }<br>}<br><br>List&lt;String&gt; get activeEntitlementIds =&gt;<br>    _customerInfo != null ? _customerInfo!.entitlements.active.values.map((e) =&gt; e.identifier).toList() : [];<br><br>Future loadOfferings() async {<br>  try {<br>    _offerings = await Purchases.getOfferings();<br>    print(&quot;Offerings&quot;);<br>  } on PlatformException catch (e) {<br>    print(&quot;Error loading offerings info: $e&quot;);<br>  }<br>}<br><br>Future loadCustomerInfo() async {<br>  try {<br>    _customerInfo = await Purchases.getCustomerInfo();<br>  } on PlatformException catch (e) {<br>    print(&quot;Error loading purchaser info: $e&quot;);<br>  }<br>}<br><br>// Return if the user has the entitlement.<br>// Return null on errors.<br>Future&lt;bool?&gt; isEntitled(String entitlementId) async {<br>  try {<br>    customerInfo = await Purchases.getCustomerInfo();<br>    return customerInfo!.entitlements.all[entitlementId]?.isActive ?? false;<br>  } on Exception catch (e) {<br>    print(&quot;Unable to check RevenueCat entitlements: $e&quot;);<br>    return null;<br>  }<br>}<br><br>// https://docs.revenuecat.com/docs/user-ids<br>Future login(String? uid) async {<br>  if (kIsWeb || uid == _loggedInUid) {<br>    return;<br>  }<br>  try {<br>    if (uid != null) {<br>      customerInfo = (await Purchases.logIn(uid)).customerInfo;<br>    } else {<br>      customerInfo = await Purchases.logOut();<br>    }<br>    _loggedInUid = uid;<br>  } on Exception catch (e) {<br>    print(&quot;Unable to logIn or logOut user in RevenueCat: $e&quot;);<br>  }<br>}<br><br>// https://docs.revenuecat.com/docs/restoring-purchases<br>Future restorePurchases() async {<br>  try {<br>    customerInfo = await Purchases.restorePurchases();<br>  } on PlatformException catch (e) {<br>    print(&quot;Unable to restore purchases in RevenueCat: $e&quot;);<br>  }<br>}</pre><p>This file contains many helper functions that will help us to integrate in-app purchases easily.</p><p>Now let’s start initializing our revenue cat in our flutter app and for that, you need to come into your <strong>main.dart </strong>file located at the root of your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*msjtPT2IhQz9eCL7MBDD-g.png" /></figure><p>Then you need to paste the following code inside your main() function:</p><pre>await revenue_cat.initialize(<br>    &quot;App Store API Key&quot;,<br>    &quot;Play Store API Key&quot;,<br>    debugLogEnabled: true,<br>    loadDataAfterLaunch: true,<br>  );</pre><p>It will look like this:</p><pre>import &#39;utilities/revenue_cat_util.dart&#39; as revenue_cat;<br><br>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await revenue_cat.initialize(<br>    &quot;appl_JaqrrbhJkytlXiZYgkfdXqnghghD&quot;, // App Store API Key<br>    &quot;goog_cGrLlvHwerVWqoYcBUxfffURHRK&quot;,  // Play Store API Key<br>    debugLogEnabled: true,<br>    loadDataAfterLaunch: true,<br>  );<br><br>  runApp(ChangeNotifierProvider(<br>    create: (context) =&gt; appState,<br>    child: MyApp(),<br>  ));<br>}</pre><p>The API Key will look like this as pasted here. Do not try these keys because it will never work 🙂. Let’s figure out where you can find it.</p><h4>API Key:</h4><p>Navigate to your revenue cat dashboard and click on the API Key tab and you will see the API keys for both the App Store and Play Store. Click on the show key copy it and replace it on the above code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvIEKKYve87nqd9e_5ePcQ.png" /></figure><p>Now when you run the app you will see the logs in your terminal where the products from Revenue Cat will be logged and info regarding it. If you are seeing that so it’s connected successfully.</p><p>Now let’s create the subscription screen where we will show all the details regarding our subscription and then do a purchase test.</p><p>Create a dart file and name it <strong>subscription_view.dart </strong>and then paste the code as mentioned below.</p><pre>import &#39;/flutter_flow/flutter_flow_icon_button.dart&#39;;<br>import &#39;/flutter_flow/flutter_flow_util.dart&#39;;<br>import &#39;/flutter_flow/revenue_cat_util.dart&#39; as revenue_cat;<br>import &#39;package:flutter/material.dart&#39;;<br>export &#39;subscribtion_view_model.dart&#39;;<br><br>class SubscriptionViewWidget extends StatefulWidget {<br>  const SubscriptionViewWidget({super.key});<br><br>  @override<br>  State&lt;SubscriptionViewWidget&gt; createState() =&gt; _SubscriptionViewWidgetState();<br>}<br><br>class _SubscriptionViewWidgetState extends State&lt;SubscriptionViewWidget&gt; {<br>  bool? purchaseOutput;<br><br>  @override<br>  void initState() {<br>    super.initState();<br>  }<br><br>  @override<br>  void dispose() {<br>    super.dispose();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return GestureDetector(<br>      onTap: () {<br>        FocusScope.of(context).unfocus();<br>        FocusManager.instance.primaryFocus?.unfocus();<br>      },<br>      child: Scaffold(<br>        backgroundColor: const Color(0xFFFFFFFF),<br>        appBar: AppBar(<br>          backgroundColor: const Color(0xFFFFFFFF),<br>          automaticallyImplyLeading: false,<br>          leading: FlutterFlowIconButton(<br>            borderColor: Colors.transparent,<br>            borderRadius: 30.0,<br>            borderWidth: 1.0,<br>            buttonSize: 60.0,<br>            icon: const Icon(<br>              Icons.arrow_back_ios_new_rounded,<br>              color: Color(0xFFFFFFFF),<br>              size: 30.0,<br>            ),<br>            onPressed: () async {<br>              context.pop();<br>            },<br>          ),<br>          actions: [],<br>          centerTitle: true,<br>          elevation: 0.0,<br>        ),<br>        body: SafeArea(<br>          top: true,<br>          child: Padding(<br>            padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),<br>            child: Column(<br>              mainAxisSize: MainAxisSize.max,<br>              children: [<br>                const Padding(<br>                  padding: EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0),<br>                  child: Text(<br>                    &#39;Subscribe to Premium Plan&#39;,<br>                    style: TextStyle(<br>                      fontWeight: FontWeight.w500,<br>                      fontSize: 20,<br>                      fontFamily: &#39;Poppins&#39;,<br>                      letterSpacing: 0.0,<br>                    ),<br>                  ),<br>                ),<br>                const Padding(<br>                  padding: EdgeInsetsDirectional.fromSTEB(0.0, 4.0, 0.0, 32.0),<br>                  child: Text(<br>                    &#39;Select one of the following Premium plans for unlimited access to all videos, then press the continue button&#39;,<br>                    textAlign: TextAlign.center,<br>                    style: TextStyle(<br>                      fontWeight: FontWeight.w500,<br>                      fontSize: 16,<br>                      fontFamily: &#39;Poppins&#39;,<br>                      letterSpacing: 0.0,<br>                    ),<br>                  ),<br>                ),<br>                Container(<br>                  width: double.infinity,<br>                  decoration: BoxDecoration(<br>                    color: const Color(0x08000000),<br>                    borderRadius: BorderRadius.circular(8.0),<br>                    border: Border.all(<br>                      color: const Color(0xFF7426EF),<br>                      width: 1.0,<br>                    ),<br>                  ),<br>                  child: Column(<br>                    mainAxisSize: MainAxisSize.max,<br>                    children: [<br>                      const Padding(<br>                        padding: EdgeInsetsDirectional.fromSTEB(0.0, 8.0, 0.0, 8.0),<br>                        child: Icon(<br>                          FFIcons.knameCrown,<br>                          color: Color(0xFFF3B22C),<br>                          size: 64.0,<br>                        ),<br>                      ),<br>                      Text(<br>                        revenue_cat.offerings!.current!.monthly!.storeProduct.title,<br>                        style: const TextStyle(<br>                          fontWeight: FontWeight.w600,<br>                          fontSize: 16,<br>                          fontFamily: &#39;Poppins&#39;,<br>                          letterSpacing: 0.0,<br>                          color: Color(0xFFA9AAAC),<br>                        ),<br>                      ),<br>                      Text(<br>                        valueOrDefault&lt;String&gt;(<br>                          revenue_cat.offerings!.current!.monthly!.storeProduct.priceString,<br>                          &#39;\$9.9 per month&#39;,<br>                        ),<br>                        style: const TextStyle(<br>                          fontWeight: FontWeight.normal,<br>                          fontSize: 14,<br>                          fontFamily: &#39;Poppins&#39;,<br>                          letterSpacing: 0.0,<br>                          color: Color(0xFFA9AAAC),<br>                        ),<br>                      ),<br>                      const Material(<br>                        color: Colors.transparent,<br>                        child: ListTile(<br>                          leading: Icon(<br>                            FFIcons.knameTick,<br>                            color: Color(0xFFF3B22C),<br>                          ),<br>                          title: Text(<br>                            &#39;High quality&#39;,<br>                            style: TextStyle(<br>                              fontWeight: FontWeight.w500,<br>                              fontSize: 14,<br>                              fontFamily: &#39;Poppins&#39;,<br>                              letterSpacing: 0.0,<br>                              color: Color(0xFFA9AAAC),<br>                            ),<br>                          ),<br>                          subtitle: Text(<br>                            &#39;HD quality (1080p) streaming&#39;,<br>                            style: TextStyle(<br>                              fontWeight: FontWeight.w500,<br>                              fontSize: 12,<br>                              fontFamily: &#39;Poppins&#39;,<br>                              letterSpacing: 0.0,<br>                              color: Color(0xFFA9AAAC),<br>                            ),<br>                          ),<br>                          tileColor: Colors.transparent,<br>                          dense: false,<br>                        ),<br>                      ),<br>                      const Material(<br>                        color: Colors.transparent,<br>                        child: ListTile(<br>                          leading: Icon(<br>                            FFIcons.knameTick,<br>                            color: Color(0xFFF3B22C),<br>                          ),<br>                          title: Text(<br>                            &#39;Full Access&#39;,<br>                            style: TextStyle(<br>                              fontWeight: FontWeight.w500,<br>                              fontSize: 14,<br>                              fontFamily: &#39;Poppins&#39;,<br>                              letterSpacing: 0.0,<br>                              color: Color(0xFFA9AAAC),<br>                            ),<br>                          ),<br>                          subtitle: Text(<br>                            &#39;Full access to all Pataka Play  Series&#39;,<br>                            style: TextStyle(<br>                              fontWeight: FontWeight.w500,<br>                              fontSize: 12,<br>                              fontFamily: &#39;Poppins&#39;,<br>                              letterSpacing: 0.0,<br>                              color: Color(0xFFA9AAAC),<br>                            ),<br>                          ),<br>                          tileColor: Colors.transparent,<br>                          dense: false,<br>                        ),<br>                      ),<br>                      const Padding(<br>                        padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 8.0),<br>                        child: Material(<br>                          color: Colors.transparent,<br>                          child: ListTile(<br>                            leading: Icon(<br>                              FFIcons.knameTick,<br>                              color: Color(0xFFF3B22C),<br>                            ),<br>                            title: Text(<br>                              &#39;Ad-free streaming&#39;,<br>                              style: TextStyle(<br>                                fontWeight: FontWeight.w500,<br>                                fontSize: 14,<br>                                fontFamily: &#39;Poppins&#39;,<br>                                letterSpacing: 0.0,<br>                                color: Color(0xFFA9AAAC),<br>                              ),<br>                            ),<br>                            subtitle: Text(<br>                              &#39;Enjoy Ad-free experience&#39;,<br>                              style: TextStyle(<br>                                fontWeight: FontWeight.w500,<br>                                fontSize: 12,<br>                                fontFamily: &#39;Poppins&#39;,<br>                                letterSpacing: 0.0,<br>                                color: Color(0xFFA9AAAC),<br>                              ),<br>                            ),<br>                            tileColor: Colors.transparent,<br>                            dense: false,<br>                          ),<br>                        ),<br>                      ),<br>                    ],<br>                  ),<br>                ),<br>                const Spacer(),<br>                Padding(<br>                  padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 30.0),<br>                  child: MaterialButton(<br>                    height: 45.0,<br>                    padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0),<br>                    color: const Color(0xFF7426EF),<br>                    shape: RoundedRectangleBorder(<br>                      borderRadius: BorderRadius.circular(8.0),<br>                    ),<br>                    onPressed: () async {<br>                      purchaseOutput = await revenue_cat.purchasePackage(<br>                        revenue_cat.offerings!.current!.monthly!.identifier,<br>                      );<br>                      if (purchaseOutput!) {<br>                        ScaffoldMessenger.of(context).showSnackBar(<br>                          const SnackBar(<br>                            content: Text(<br>                              &#39;You have successfully subscribe to the monthly plan!&#39;,<br>                              style: TextStyle(<br>                                color: Color(0xFFA9AAAC),<br>                              ),<br>                            ),<br>                            duration: Duration(milliseconds: 4000),<br>                            backgroundColor: Color(0xFF000000),<br>                          ),<br>                        );<br><br>                        /// Route to navigate to your dashboard<br>                        /// Replace it with yours<br>                        /// The current one will not work for you<br><br>                        // context.pushNamed(SeriesTitleViewWidget.routeName);<br>                      } else {<br>                        ScaffoldMessenger.of(context).showSnackBar(<br>                          const SnackBar(<br>                            content: Text(<br>                              &#39;Something went wrong during purchase!&#39;,<br>                              style: TextStyle(<br>                                color: Color(0xFFA9AAAC),<br>                              ),<br>                            ),<br>                            duration: Duration(milliseconds: 4000),<br>                            backgroundColor: Color(0xFF000000),<br>                          ),<br>                        );<br>                      }<br>                    },<br>                    child: const Text(&#39;Subscribe Now&#39;),<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>Adjust it if you wanna change color and or any text styles you wanna change. So this will display your product from the RevenueCat dashboard.</p><h3>Sandbox Testing</h3><p>You don’t need to make real purchases to test your subscriptions. Instead, use the <strong>sandbox environments</strong>, which simulate real store behavior without any costs. This allows you to verify your implementation before going live.</p><h4>Apple App Store &amp; TestFlight</h4><p>In <strong>Sandbox</strong>, <strong>StoreKit Test</strong>, and <strong>TestFlight</strong>, prices may differ from <strong>App Store Connect</strong> due to instability, but this usually doesn’t affect production.</p><h4>Create a Sandbox Test Account:</h4><p>To test purchases, you’ll need a <strong>sandbox test account</strong>. Create one in <strong>App Store Connect</strong> under <strong>Users and Access &gt; Sandbox Testers</strong>.</p><p>For assistance, refer to <a href="https://developer.apple.com/">Apple’s guide</a> on creating sandbox testers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*380_VCkb7hnve33nnz_yLg.png" /></figure><blockquote>Keep in mind you’ll need to create sandbox accounts with valid emails that you can verify you own.</blockquote><h4>Testing on Real iOS Device:</h4><p>For <strong>iOS 13 and earlier</strong>, sandbox purchases must be tested on a real device. Starting from <strong>iOS 12</strong>, you can add a sandbox account without signing out of your Apple Developer account.</p><ul><li><strong>iOS 12+</strong>: <strong>Settings &gt; [Your Account] &gt; App Store &gt; Sandbox Account</strong></li><li><strong>iOS 13+</strong>: <strong>Settings &gt; App Store &gt; Sandbox Account</strong></li><li><strong>iOS 18+</strong>: <strong>Settings &gt; Developer &gt; Sandbox Apple Account</strong></li><li><strong>macOS 11.5.2+</strong>: <strong>App Store &gt; Preferences &gt; Sandbox Account</strong></li></ul><p>Enter the sandbox account credentials you created. These won’t appear until a purchase is made in a development build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-nzAkaTQZrUPAyOW65-BQ.jpeg" /></figure><blockquote>If the sandbox account option is missing in iOS settings, make a sandbox purchase in your app. Apple will prompt you to enter login details, and the account will then appear in iOS settings.</blockquote><p>If you got any issues while testing it and still not resolved you can read this article also to trouble shoot and understand the bug. Although till step all work fine for me.</p><p><a href="https://www.revenuecat.com/docs/test-and-launch/sandbox/apple-app-store">Apple App Store &amp; TestFlight | In-App Subscriptions Made Easy - RevenueCat</a></p><h4>Google Play Store Testing</h4><p>I’ve successfully tested on emulators, but Google recommends using a real device. If using an emulator, ensure <strong>Google Play Services</strong> is installed.</p><h4>Configure licensing testing:</h4><p>Go to your Google Play console and navigate to the settings tab then License Testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GpXBvJSNNS8C3F4du_gdHA.png" /></figure><p>Now in order to move forward you need to create a closed track that’s for closed testing we do. If you already added your testers you will be able to select them if not then follow the steps.</p><h4>Create a closed track and add a tester to it:</h4><p>You’ll need to publish a <strong>signed version</strong> of the app to a <strong>closed track</strong>. If you haven’t set one up yet, create it under <strong>Testing &gt; Closed testing</strong> in the Play Console.</p><blockquote>If you don’t know how to create the signed APK, then please check my article, in which I explained the steps for publishing the mobile app. You will find that there.</blockquote><blockquote><a href="https://medium.com/blocship/publish-flutter-app-to-play-store-69cb0cd5a30b">https://medium.com/blocship/publish-flutter-app-to-play-store-69cb0cd5a30b</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Le_n2PQV2J-CnaHP7whnsg.png" /></figure><p>If you already have a track previously created so just go into that and create a email list or create a track then you will have open to create an email list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JbRxiykG70VXdtUbNISPQ.png" /></figure><p>Just name it and enter the testers&#39; email addresses. Make sure the email is correct and active because Google will check when you try to save it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qm5EGXmc7yg6sctY1he0iQ.png" /></figure><p>Then save changes. In this way you would have access to license testing to these emails.</p><h4>How it works?</h4><p>When you pushed it to closed testing. (If you don’t know how to push to closed testing then let me know in the comments I will make a detailed blog for a guide) The tester emails that you put has to be opted-in to download the app. Where you create the email list you will see this option also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oZjCh77Kqw4ZYI3rBuMevA.png" /></figure><p>Copy the <strong>link on the web </strong>and then send it to the testers, which is the email you put in. If you also put your email so just paste that link into to browser and you will see this as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*72n46cNw7OM9FbNONc8a6Q.png" /></figure><p>If you don’t see this so make sure you are here with the correct Google account email that you provided. You can switch the account from the top right corner in the above image. After that, just click on the Become A Tester to move forward. Then you will see the option to download the app from the Play Store. Just go download it and open it.</p><p>When you&#39;re done with adding the testers on the play console, we have to do one more step that is required for the testers to test the in app purchases. Navigate back to the License testing tab, and you will find this message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNXsfx6bYvQXUav5lsiXyA.png" /></figure><p>Go to the Integrity API and then select your account first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*l73CyLk8g2w4YPQiPeOtFw.png" /></figure><p>After that, if you have multiple apps so you need to select your app from the search dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ka0LBJt5zAYIYa7sfE5GDA.png" /></figure><p>After that, you need to come down and need to complete the steps here. First, read the documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SYESwEVUqzB_ragdYLfsGA.png" /></figure><p>Just go through what they are listed there. Then come back and click on the <strong>Link Cloud Project </strong>will show the sheet, and select your cloud project from here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppUHLYz2hFiatkQSJBYTdA.png" /></figure><p>It might be difficult to switch the project here if you have multiple projects because it links to the top one by default. In that case, copy the project number from the list and then add it manually, and then click on Link Project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LxjJDLiffJbPtdtbM5Cq_g.png" /></figure><p>Then click on Enter project number manually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUhWDElp-NrxP-cCPkH2CQ.png" /></figure><p>Then enter the copied number there and hit the button<strong> Link Project.</strong></p><p>After that, you would see your project name here which means it linked successfully!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nls9DQogjkFp_wCUwQCKyQ.png" /></figure><p>So this step would be enough for testers to test it.</p><h4>Test</h4><blockquote>Now the important point is how the purchase works. When you go to the subscription screen and try to make a purchase, it links with your Google account that signed in to your Play Store in case of Android. So make sure the correct account is selected there which you provided as a tester.</blockquote><p>When you go to test and purchase your plan so you will see the option that says test card, always approves, and just click on subscribe, and it will succeed if everything is configured correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*ypbCP2ICck72wHwZBzENug.jpeg" /></figure><blockquote>For testing, Google set the renewal period to 5 minutes by default, which means when you subscribe, it will expire after 5 minutes, just for testing correctly.</blockquote><p>Then click on subscribe, and then the magic happens, and it will subscribe successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuX-T0uKKcRYFEFJ3gegvg.jpeg" /></figure><blockquote>When you make a purchase how you will give users access to premium content, so for that you have to store this info on your server side. You must have variables like isSubscribed for every user, along with other details like when subscribed which will help you to keep track of it.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxlLXxwo3F3aqFFOVplwPQ.png" /></figure><blockquote>The main problem arises when you log out of the current user and log in to another user, so you would see the other user not able to buy the plan, and it will show as already purchased. This is because Google stores the token against the app and marks it as purchased. This data is stored on your Play Store account. You can check it by going to the Payment and Subscriptions tab on your mobile, and you will see it there.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LP2jjKbnEqVfvwpaMzMOZQ.jpeg" /></figure><p>Now just click on the Manage subscriptions, and you will see your subscription associated with your Google Play Store account and the option to cancel the subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*vMJphwO_Nh5maNt6OZylYg.jpeg" /></figure><p>If you wanna cancel the subscription so you can cancel it from here, and then the other accounts will be able to purchase it.</p><p>Once your app lands in production for both stores, the user will be able to buy the subscription for real. This marks the end of this a bit long, knowledgeable article. 😅 If I miss something and you face any difficulty while integrating it so don’t hesitate to reach out.</p><p>You can find me on LinkedIn. Click on the logo:</p><figure><a href="https://www.linkedin.com/in/affan-minhas/"><img alt="" src="https://cdn-images-1.medium.com/max/275/1*jN9OKUho03-qbwzoRSu0BQ.jpeg" /></a></figure><p>If you like this article and want more articles like this, please show support for me.</p><figure><a href="https://buymeacoffee.com/affansulta8"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3BFiSb2mC7FcJLye94-0Wg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36adbef2c2d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/in-app-purchases-with-revenue-cat-flutter-2025-36adbef2c2d5">In-App Purchases With Revenue Cat Flutter — 2025</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish Flutter App to Play Store 2025]]></title>
            <link>https://medium.com/blocship/publish-flutter-app-to-play-store-69cb0cd5a30b?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/69cb0cd5a30b</guid>
            <category><![CDATA[publishing]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[play-store]]></category>
            <category><![CDATA[app-publishing]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Sun, 24 Mar 2024 10:44:35 GMT</pubDate>
            <atom:updated>2025-09-07T11:54:35.173Z</atom:updated>
            <content:encoded><![CDATA[<p>Congratulations!! 🥳 on completing your Flutter app! Now it’s time to share your creation with the world by publishing it on the Google Play Store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*feqT3gRW6Eorw5fYNmTz-Q.png" /></figure><p>In this guide, we’ll walk you through the step-by-step process of preparing your app for publication and navigating the Google Play Console to make your app available to millions of users.</p><h3>Prepare Your Flutter App for Release</h3><p>Before you can publish your app on the Google Play Store, you need to ensure that it is ready for release. Here are some key steps to prepare your Flutter app:</p><h4>Step 01: Set App Launcher Icon</h4><p>Before publishing to play store your app must have a icon for unique identification. The launcher icon look like as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7uoohXhXtsp6zg4huMm68A.png" /><figcaption>Launcher Icon Example</figcaption></figure><p>You see how the Gmail App Icon look like same as it is your flutter app must have an icon. How can you generate it? 🤔 If you have your app logo and wanna make that logo as app icon so just do these steps:</p><p>First go to this website that allows you to check how your logo will look like to the android and iOS device.</p><p><a href="https://icon.kitchen/i/H4sIAAAAAAAAA6tWKkvMKU0tVrKqVkpJLMoOyUjNTVWySkvMKU6t1VHKzU8pzQHJRisl5qUU5WemKOkoZeYXA8ny1CSl2FoApT8%2BHkAAAAA%3D">https://icon.kitchen/i/H4sIAAAAAAAAA6tWKkvMKU0tVrKqVkpJLMoOyUjNTVWySkvMKU6t1VHKzU8pzQHJRisl5qUU5WemKOkoZeYXA8ny1CSl2FoApT8%2BHkAAAAA%3D</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i28qDmJGOHDYvo1wrGHJVQ.png" /></figure><p>If you have your app logo then you can select the image and upload your app logo and can see how it’s look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1h-xhSdttZgl2Kcgf3VUGg.png" /></figure><p>After that you can download it from there. It will download the Zip file. Just open the zip file and go to android folder and copy the folder as shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*omOiHLQmZ_f2RxBmq7x2Fg.png" /></figure><p>Now, you need to paste these folders in your flutter project. Open your flutter project and go to android folder to res as shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r2aLpArdFsAGpfdL4gDWxQ.png" /></figure><p>That’s it your app icon is changed now. You can test it by running your flutter project.</p><h4>Step 02: Set App Name</h4><p>Your app name is one for which users will identify it. The app name look like as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hCHKaoCuJiok1y7CeZRYQQ.png" /><figcaption>App Name Example</figcaption></figure><p>Like Gmail is the name for this app. How you can change it? 🤔 Just go to the flutter project and to the AndroidManifest.xml and change it like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iRfUvdS6T8SKWt47mBcyBQ.png" /></figure><p>That’s it your app name is changed now. You can test it by restart the app.</p><h4>Step 03: Build &amp; Release App</h4><p>In this step you need to Sign your app to release it into play store. For that lets go to your flutter project and follow these simple steps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MnxEr4k-5GyO83AC8Q8JEA.png" /><figcaption>Create file key.properties</figcaption></figure><p>Now paste this code inside your key.properties file.</p><pre>storePassword=&lt;password-from-previous-step&gt;<br>keyPassword=&lt;password-from-previous-step&gt;<br>keyAlias=upload<br>storeFile=&lt;keystore-file-location&gt;</pre><p>Now you can define any password of your choice but make it sure you should not share it to any one. It would look like now as:</p><pre>storePassword=MyFlutterApp<br>keyPassword=MyFlutterApp<br>keyAlias=upload<br>storeFile=&lt;keystore-file-location&gt;</pre><p>Next step is to <strong>create an upload keystore.</strong></p><p>If you are using Mac or Linux so copy this command below:</p><pre>keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload</pre><p>Or If you are using windows then copy this command below:</p><pre>keytool -genkey -v -keystore %userprofile%\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload</pre><p>At %userprofile% you must provide the path to store this file. Like in my case I provide it C:\Users\AFFAN MINHAS and also you need to wrap it in quotation marks.</p><p>Your updated command for windows would look like:</p><pre>keytool -genkey -v -keystore &quot;C:\Users\AFFAN MINHAS\upload-keystore.jks&quot; -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload</pre><p>Make sure you paste the right command not to face any error. After that it will say to enter the <strong>keystore password</strong> where you will enter the same password you set on your <strong>key.properties</strong> file. After that it would required some basic details that you need to enter to complete this process. I have done this for your reference see below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q7iUArZWBwcT7NhMbhuoCA.png" /></figure><p>The info given here is temporary so make sure you provide right info according to yours. If you done all good then the <strong>upload-keystore.jks </strong>would be downloaded to your specified location.</p><p>Now copy the <strong>upload-keystore.jks </strong>file and paste it into android/app folder and also update the right path into your <strong>key.properties </strong>file as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lizH1crgen5elqdEaFadRA.png" /></figure><p>Now we need to configure signing in gradle of your flutter project.</p><p>Just go to the [project]/android/app/build.gradle file of your project and paste the following code above the android tag:</p><pre> def keystoreProperties = new Properties()<br>   def keystorePropertiesFile = rootProject.file(&#39;key.properties&#39;)<br>   if (keystorePropertiesFile.exists()) {<br>       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))<br>   }</pre><p>Your gradle file should look like this after adding this code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ukjh9y5b3AIASCDLAI5FZQ.png" /></figure><p>Then you need to copy this code and again go to the gradle file on very bottom to paste there:</p><pre>   signingConfigs {<br>       release {<br>           keyAlias keystoreProperties[&#39;keyAlias&#39;]<br>           keyPassword keystoreProperties[&#39;keyPassword&#39;]<br>           storeFile keystoreProperties[&#39;storeFile&#39;] ? file(keystoreProperties[&#39;storeFile&#39;]) : null<br>           storePassword keystoreProperties[&#39;storePassword&#39;]<br>       }<br>   }<br>   buildTypes {<br>       release {<br>           signingConfig signingConfigs.release<br>       }<br>   }</pre><p>Make sure this complete code should be pasted there as you find the previously written buildTypes tag so overwrite completely and paste it. You gardle should look like after pasting it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XmPxY7yNQaycUgziVBgn3w.png" /></figure><p>Now the configuration is completed and it’s time to build the app bundle by running the following commands. First open the terminal and go to your root project like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G6tTLqvUkG5Ofm4r5tiEgA.png" /></figure><p>After that run these commands one by one:</p><ol><li>flutter clean</li><li>flutter pub get</li><li>flutter build appbundle</li></ol><p>After successful execution it will generate the .aab file to the location <strong>build\app\outputs\bundle\release\app-release.aab </strong>for your project.</p><p>Now, for the security purpose we don’t push these key.properties and upload-keystore.jks file to github. To do this you need to put it into .gitignore file that make this happen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwtNuPutCN36sXUwgggx-Q.png" /></figure><p>This step is very important because if any one have access to your key or keystore so they can upload a new app version to Play Store and can override your app version that you have uploaded.</p><h4>Step 04: Publish to Play Store</h4><p>Now, your app bundle is reading so the final step to publish it to play store. For that it is necessary that you have developer account of google play console. First go and create developer account from here:</p><p><a href="https://play.google.com/console/signup">Google Play Console</a></p><p>After that you need to pay the one time fees that is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*hJXt9otRtb30Mpar8mNM-g.png" /></figure><p>After successful registration you will have your developer account where you can upload your apps.</p><blockquote>If you are working for a client so you need ask a access on your mail account so that can upload the app for them.</blockquote><p>Go to your console: <a href="https://play.google.com/console">https://play.google.com/console</a></p><p>Now let’s start publishing your app. First create an app as shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zA-AhJqTRNsOr6cL4HHcbw.png" /></figure><p>After that provide the information according to your app. I am giving you just an example of putting data.</p><ul><li>Name your app whatever you want.</li><li>Select the default language of your app.</li><li>Select whether it is just an app or any gaming app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QulBJF5RGtU94Zwf1t7o7A.png" /></figure><ul><li>Make sure if you are making your app free this time so you would never change it into future so decide it accordingly.</li><li>And, obviously you need to check the declarations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jajzfvpfcXXFVFF1oBMjw.png" /></figure><p>By this your app is created successfully. Now you need to start the configuration by providing your app details.</p><ul><li>Just go to the store settings tab.</li><li>Provide if it is app or game.</li><li>Select the right category of your app.</li><li>Then select the correct tags that your based on. You can select up to 5 tags.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oHb6WRRodwrlRAD8wgGFfg.png" /></figure><ul><li>Then provide the contact details where all app related notification will receive. It includes the app launches details or etc.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oZtUrZ956mr9-ab3UASL7g.png" /></figure><ul><li>After that provide the necessary app details</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7gkaUYdNziQp9Ij1nKnzww.png" /></figure><ul><li>Now scroll down and you need to provide your app icon and make sure the dimention and size as listed here:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*jHiMc4-rkGaYkkI7bji4vw.png" /></figure><ul><li>Now you need to provide the feature graphics of your app which will show as cover photo of your store listing.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*3RgQXrds_6bJXZGL3tGhmg.png" /></figure><ul><li>Now you need to provide the screen shots of phone screen where 2 is the minimum and 8 is the the maximum.</li><li>You can also provide the video link to showcase your app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*ZyG9FFtrFfubT1X4m1XD2Q.png" /></figure><ul><li>You are also needed to provide the screen shots of 7-inch tablets and 10-inch tablets. You can provide the same screen shots to these if you don’t have specifically for it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*xLh_QPCWvIEWUhqPKB0erg.png" /></figure><p>Now there are list of tracks where you can upload your app. There are follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*znHbEnt1YV5hQTvN7Lxw4g.png" /><figcaption>All Uploading Tracks</figcaption></figure><p>Let’s say we are uploading for public rating so we choose the production track.</p><ul><li>Go to production tab and then create new release.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TeC1PFXAqs0EBFKq8ny9LA.png" /></figure><ul><li>Now you will have to choose the signing key.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2EnB3WTSNlA3GkbQw1Zpg.png" /></figure><ul><li>Then choose google-generated key.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*qahOss9TFCC0TmERjaz89Q.png" /></figure><ul><li>Now you need to upload the app bundle which we have created in start. can find your bundle on your project location.</li><li>In my case the path is:</li><li>D:\FlutterProjects\[project_name]\build\app\outputs\bundle</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpvd9dLFnsrtv2U1vsSx-g.png" /></figure><ul><li>After that you can enter the message for this release like if you have new updates and features so can show as message here.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eWvi4eaeKEsr4W3DVGqjIg.png" /></figure><ul><li>Now you would be facing some errors like shown</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bTge5yX_OdsYuvqbNAPTvg.png" /></figure><ul><li>Let resolve it to finally rollout this app.</li><li>Click back on production tab and go to select the contries and region for where your app will be available. You can select or de-select any if you don’t want your app there.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpQrAn3s35D0i6RJCii7mQ.png" /></figure><ul><li>Now you need to select the countries. If you want all so simply select all from there and save it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSFJgNxTz5gTQPDNO4-4fw.png" /></figure><ul><li>After that go down on action tab and find app content tab where you need to provide the further declaration for this app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iKV0Mud3FPZprHJoNABpNA.png" /></figure><ul><li>Here you need to provide the URL hosted on any where that shows your app privacy policy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vpl20LtgIZSYs_iAoZIjpw.png" /></figure><ul><li>In simple we can create a GitHub repository and create a simple file here and provide the URL here. Let’s see how we can do that.</li><li>Follow the URL where you find the dummy template of the privacy policy just copy it from there:</li></ul><p><a href="https://github.com/quangctkm9207/template-files/blob/master/common/PRIVACY-TEMPLATE.md">template-files/common/PRIVACY-TEMPLATE.md at master · quangctkm9207/template-files</a></p><ul><li>Copy the template from there:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c35_vUfgHgVmhn1vIRVUUA.png" /></figure><ul><li>After that you need to create repository into your GitHub account so for that just go to <a href="https://github.com/">https://github.com</a> and create a repository there.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*UzDhvpc76opXsDqOv5MFSg.png" /></figure><ul><li>Give name to your repository and make sure you select it to public so that any one can see it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9USHqa7yUyD4hb-lWsFfg.png" /></figure><ul><li>After that just create a new file from there:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jALC0UuaIraJzNRg4NKuLg.png" /></figure><ul><li>Then paste the content and edit it and finally save it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6eOUUxncTHL2wclhRaae5Q.png" /></figure><ul><li>After that copy the path to repository and paste it there where privacy policy URL was needed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CWofWHKKEn-06GEQFC7FIA.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>Now you need to tell whether your app contains ads or not? go to ads declaration by clicking start Start declaration:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*8asDGu7a2lWAqESuPl0deQ.png" /></figure><p>After that choose according to your app whether contains ads or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9fd075hBGOef26IMaVsrA.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>Now you need to tell whether your app can be access completely or some part needs special access.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*2ssUAIdoZcbG2qkoxKIzqA.png" /></figure><p>Do according to your app if all functionality is accessible without any restriction or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*7Vssm9ZTeWLKBEBberHGaw.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>Now its time to tell the content rating and start the questionnaire</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*-RPEoyeGS33a7618NUd2ww.png" /></figure><p>You need to give the email address and category as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H3SZkpUKneOBEspqxWG3fA.png" /></figure><p>Then do answer these questionnaire according to your app and go next:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FqVBKw_IgALDnhtnj7-SYw.png" /></figure><p>After that there would be the summary of what you have selected just save it after review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8TvutwwhlU6oQmE7d8_CCA.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>After that you need to tell your target audience:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*33hlGUJqDltA-mXv2KXKTg.png" /></figure><p>Select it according to your app and then save it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dIgdX0VOYbF6ldPBo8HDOg.png" /></figure><p>Then you need tell whether your app any personal data or not. Do save and save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLkiqpiTNOB0-_bgp8yS4A.png" /></figure><p>If you want your app to be tested by teachers so you can apply for it then hit save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*9xTBR_NLX9nqxRydaazyCw.png" /></figure><p>Then finally save it and clear this step and get back from it with the arrow above.</p><ul><li>Now you need to tell whether your app is a news app or not.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*zy--SRCDpcb0eyzrCqWXOQ.png" /></figure><p>Choose according to your app purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*UJbfk3-aviUplcyvWe4XHQ.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>After that you need to tell if your app is a COVID-19 contact tracing or status app or other.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*LgNjIozW0qo95E4VDUFacQ.png" /></figure><p>Choose according to your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHltbnxsT6Ax_5Z2CQZOOA.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>After that you need to tell about your app’s privacy and security practices.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*LbJaVA1kQImv2vgXYHAv6g.png" /></figure><p>Provide these details and hit next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tkb1KRhQ5qE8mTffeeoDYQ.png" /></figure><p>Then finally save it and clear this step and get back from it with the arrow above.</p><ul><li>After that you need to tell whether your app uses advertising ID or not.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*_o8tdQ5v-GLQhORLvOs6TQ.png" /></figure><p>Choose according to your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*0-zTfbG-yARlp8h2UnfytQ.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>After that you need to tell whether your app is government property or not.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*oRXa2U2SC9R_og7r0fW05g.png" /></figure><p>Choose according to your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*3aeADp9C8epKvbBBzP9wQw.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><ul><li>After that you need to tell the financial feature of your app</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*bBrhGS0O5I9ZwWU5W4BAVQ.png" /></figure><p>Choose according to your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*xoOwGtQtwBFYwsJNtIapbg.png" /></figure><p>Now save it to clear this step and get back from it with the arrow above.</p><p>After completing all these declaration get back to the production tab and go to the edit release.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7u1BI4bYgVNvetHDlDJRqw.png" /></figure><p>Then check every details and click on next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sI0dyIPVnbi-jGj5-8zRwQ.png" /></figure><p>After that save it and go to overview.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*okotpHqkkCq10vwVvLBBZQ.png" /></figure><p>Now, finally send these changes to google for review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iurWrRWnb7s3jsFVF-Gx1w.png" /></figure><p>Now, if you come to all app section so you would see the app sent for review 😍</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYbVC-wXduuefYchebuB8w.png" /></figure><p>Finally you did it!🥴 your app is sent for review and it would take around 48 hours to give you any response. Make sure if your app uses user current location or these type of features so google will ask to provide the valid details for accessing it.</p><p>If you face any difficulty for doing it you can reach me out through linkedIn or can run through email. I would be happy to help you on it. Don’t forget to clap if you really like and it helps you. Thank You!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_oYdALbIZwWcAttZULvZ7A.png" /></figure><h4><a href="https://www.buymeacoffee.com/affansulta8">Support me </a>👈</h4><h4>Follow me &amp; Connect:</h4><p>LinkedIn: <a href="https://www.linkedin.com/in/affan-minhas/">https://www.linkedin.com/in/affan-minhas/</a></p><p>GitHub: <a href="https://github.com/affanminhas">https://github.com/affanminhas</a></p><p>Email: affanminhasdev@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69cb0cd5a30b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/publish-flutter-app-to-play-store-69cb0cd5a30b">Publish Flutter App to Play Store 2025</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Secrets of Time Tracking in Flutter Apps]]></title>
            <link>https://medium.com/blocship/unveiling-the-secrets-of-time-tracking-in-flutter-apps-fe91d47d709c?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe91d47d709c</guid>
            <category><![CDATA[time-log]]></category>
            <category><![CDATA[time-tracking-app]]></category>
            <category><![CDATA[time-tracking]]></category>
            <category><![CDATA[flutter-timer]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Mon, 11 Mar 2024 04:47:32 GMT</pubDate>
            <atom:updated>2024-03-12T16:58:48.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*RR8ymu_XktbXVhv7OfzqDQ.png" /><figcaption>Time Tracking Flutter</figcaption></figure><p>Ever wondered how much time users spend on your Flutter app? Tracking user engagement and session duration is essential for understanding user behavior and optimizing app performance. In this article, we’ll explore various techniques and tools to effectively track the time users spend within your Flutter app.</p><h3>Implementing Lifecycle Events:</h3><ul><li>Flutter provides lifecycle events that allow you to track when your app enters the foreground and background.</li><li><strong>Example: </strong>Utilize the WidgetsBindingObserver to spy on your app’s lifecycle events like a detective in a mystery novel.</li></ul><pre>class _MyAppState extends State&lt;MyApp&gt; with WidgetsBindingObserver {<br>  @override<br>  void initState() {<br>    super.initState();<br>    WidgetsBinding.instance.addObserver(this);<br>  }<br><br>  @override<br>  void dispose() {<br>    WidgetsBinding.instance.removeObserver(this);<br>    super.dispose();<br>  }<br><br>  @override<br>  void didChangeAppLifecycleState(AppLifecycleState state) {<br>    if (state == AppLifecycleState.resumed) {<br>      // App entered foreground<br>      // Start tracking time<br>    } else if (state == AppLifecycleState.paused) {<br>      // App entered background<br>      // Stop tracking time<br>    }<br>  }<br>}</pre><h3>Using Timer Functionality:</h3><ul><li>Utilize Flutter’s Timer class to track time intervals within your app.</li><li><strong>Example:</strong> Start a timer when the app enters the foreground and stop it when it enters the background, just like pausing a movie when you need to refill your popcorn.</li></ul><pre>Timer? _timer;<br><br>void startTimer() {<br>  _timer = Timer.periodic(Duration(seconds: 1), (timer) {<br>    // Update time spent in app<br>  });<br>}<br><br>void stopTimer() {<br>  if (_timer != null) {<br>    _timer!.cancel();<br>    _timer = null;<br>  }<br>}</pre><h3>Utilizing Analytics Services:</h3><ul><li>Integrate analytics services like Firebase Analytics or Google Analytics to track user engagement and session duration.</li><li><strong>Example:</strong> Use Firebase Analytics to log custom events for app foreground and background transitions, becoming the Sherlock Holmes of app analytics.</li></ul><pre>FirebaseAnalytics().logEvent(<br>  name: &#39;app_session&#39;,<br>  parameters: {&#39;session_duration&#39;: durationInSeconds},<br>);</pre><h3>Storing Data Locally:</h3><ul><li>Store time tracking data locally using shared preferences or SQLite databases for offline tracking.</li><li><strong>Example:</strong> Store session start and end times locally for further analysis, like keeping a secret diary of your app’s adventures.</li></ul><pre>SharedPreferences prefs = await SharedPreferences.getInstance();<br>prefs.setInt(&#39;session_start_time&#39;, DateTime.now().millisecondsSinceEpoch);</pre><h3>Conclusion:</h3><p>Tracking the time users spend within your Flutter app is crucial for understanding user behavior and making data-driven decisions. By implementing lifecycle events, utilizing timers, integrating analytics services, and storing data locally, you can gain valuable insights into user engagement and optimize your app for success. So, let’s start tracking and make every second count! Remember, “<strong><em>Time flies like an arrow; fruit flies like a banana.</em></strong>” 🕒</p><p>Follow me on LinkedIn:<br><a href="https://www.linkedin.com/in/affan-minhas/">https://www.linkedin.com/in/affan-minhas/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe91d47d709c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/unveiling-the-secrets-of-time-tracking-in-flutter-apps-fe91d47d709c">Unveiling the Secrets of Time Tracking in Flutter Apps</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Taming Tedium with Flutter Freeze: Effortless Code Generation for Your Flutter Apps]]></title>
            <link>https://medium.com/blocship/taming-tedium-with-flutter-freeze-effortless-code-generation-for-your-flutter-apps-bc8b8b9ab26a?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc8b8b9ab26a</guid>
            <category><![CDATA[flutter-code-generation]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-freezed]]></category>
            <category><![CDATA[code-generation]]></category>
            <category><![CDATA[freezed]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 11:10:40 GMT</pubDate>
            <atom:updated>2024-03-06T11:44:49.742Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDOdB5kQSey9EvxSUgdTXg.jpeg" /><figcaption>Flutter Freeze</figcaption></figure><p>In the ever-evolving world of Flutter development, <strong>efficiency</strong> is paramount. While the framework itself empowers us to create stunning and interactive apps, writing boilerplate code can bog down our progress. But fear not, Flutter developers, for a valiant hero stands ready to combat this tedium: <strong>Flutter Freeze</strong>!</p><h3><strong>What is Flutter Freeze?</strong></h3><p>Flutter Freeze is a powerful package that utilizes code generation to <strong>automate the creation of essential methods</strong> for your data classes, saving you precious time and effort.</p><h3><strong>Why Use Flutter Freeze?</strong></h3><ul><li>Say goodbye to manually writing copyWith, toString, ==, and hashCode methods. Freeze handles these for you, keeping your code clean and concise.</li><li>With less boilerplate, your code becomes more <strong>readable and understandable</strong>, both for you and your fellow developers.</li><li>Freeze facilitates seamless <strong>serialization (conversion to/from JSON)</strong>, making data persistence and communication a breeze.</li></ul><h3><strong>Getting Started with Flutter Freeze</strong></h3><ul><li><strong>Installation:</strong> Add the freezed_annotation and build_runner packages to your pubspec.yaml file:</li></ul><pre>dependencies:<br>  freezed_annotation: ^2.1.2<br>dev_dependencies:<br>  build_runner: ^4.3.1<br>  freezed: ^2.2.1</pre><ul><li><strong>Generate Code:</strong> Run the following command in your terminal to initiate code generation:</li></ul><pre>flutter pub run build_runner watch</pre><h3><strong>Creating Your First Data Class</strong></h3><ul><li><strong>Import the Package:</strong> In your Dart file, import the freezed_annotation package:</li></ul><pre>import &#39;package:freezed_annotation/freezed_annotation.dart&#39;;</pre><ul><li><strong>Annotate Your Class:</strong> Use the @freezed annotation to mark your class for code generation:</li></ul><pre>@freezed<br>abstract class UserModel with _$UserModel {<br>  const factory UserModel({<br>    required String firstName,<br>    required String lastName,<br>    required String email,<br>  }) = _UserModel;<br>}</pre><p>That’s it! Now, running flutter pub run build_runner watch will generate a separate file (user_model.g.dart) containing the following methods:</p><ul><li>copyWith<strong>:</strong> Allows you to create a new instance of the class with modified properties, keeping the original intact.</li><li>toString<strong>:</strong> Returns a string representation of the object for debugging and logging purposes.</li><li>==<strong> and </strong>hashCode<strong>:</strong> Enable comparison and hashing of objects, essential for equality checks and efficient data storage.</li></ul><h3><strong>Example Usage</strong></h3><pre>UserModel user = UserModel(<br>  firstName: &#39;Affan&#39;,<br>  lastName: &#39;Minhas&#39;,<br>  email: &#39;affan.minhas@example.com&#39;,<br>);<br><br>// Create a new user with an updated email<br>UserModel updatedUser = user.copyWith(email: &#39;affansultan@example.com&#39;);<br><br>print(user.toString()); // Prints &#39;UserModel(firstName: John, lastName: Doe, email: john.doe@example.com)&#39;<br><br>if (user == updatedUser) {<br>  print(&#39;Objects are equal&#39;); // This won&#39;t be printed because the emails differ<br>}</pre><h3><strong>Beyond the Basics</strong></h3><p>Flutter Freeze offers several additional features to enhance your data classes further:</p><ul><li><strong>Unions and Sealed Classes:</strong> Model complex data structures like login states or error types using unions or sealed classes.</li><li><strong>Custom Serialization:</strong> Control the serialization process with custom toJson and fromJson methods.</li></ul><h3><strong>Conclusion</strong></h3><p>By embracing Flutter Freeze, you can <strong>streamline your development process</strong>, reduce boilerplate code, and craft cleaner, more readable, and maintainable Flutter apps. So, ditch the tedium and embrace the power of code generation!</p><h4><strong>Remember:</strong></h4><ul><li><strong>Keep your data classes immutable</strong> to enhance code stability.</li><li><strong>Leverage unions and sealed classes</strong> for complex data structures.</li><li><strong>Consider custom serialization</strong> for specific scenarios.</li></ul><p>With Flutter Freeze by your side, you’ll be well on your way to building <strong>exceptional and efficient Flutter applications</strong>!</p><h4>Sources:</h4><ul><li><a href="https://pub.dev/packages/freezed">freezed | Dart package</a></li><li><a href="https://github.com/mohitsolankee22/flutter_explore_freezed">GitHub - mohitsolankee22/flutter_explore_freezed</a></li></ul><h4>Follow Me:</h4><p><a href="https://github.com/affanminhas">affanminhas - Overview</a></p><p><a href="https://www.linkedin.com/in/affan-minhas/">https://www.linkedin.com/in/affan-minhas/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc8b8b9ab26a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/taming-tedium-with-flutter-freeze-effortless-code-generation-for-your-flutter-apps-bc8b8b9ab26a">Taming Tedium with Flutter Freeze: Effortless Code Generation for Your Flutter Apps</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Let’s Debug: A Fun Flutter Adventure! ]]></title>
            <link>https://medium.com/blocship/lets-debug-a-fun-flutter-adventure-c99687c42e10?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/c99687c42e10</guid>
            <category><![CDATA[debug]]></category>
            <category><![CDATA[bug-fixes]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Sat, 17 Feb 2024 18:53:02 GMT</pubDate>
            <atom:updated>2024-02-18T15:06:30.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HhPhvBSmfzyguQdIcJnWnw.png" /></figure><p>Hey there, fellow code warriors! Welcome to Let’s Debug, where we’re diving into the wild world of Flutter debugging. Ever found yourself facing a bug and thinking, “Ohh, it’s a bully shit!”? Don’t worry, we’ve all been there! Let’s explore Flutter debugging together in a fun and easy-to-understand way.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FEZZuTSrLn9nV45nazA%2Fvideo&amp;display_name=GIPHY&amp;url=https%3A%2F%2Fgiphy.com%2Fclips%2Fstudiosoriginals-hello-EZZuTSrLn9nV45nazA&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2FEZZuTSrLn9nV45nazA%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="480" height="320" frameborder="0" scrolling="no"><a href="https://medium.com/media/2dd2c76389c8e5aeb44ee43618c702b9/href">https://medium.com/media/2dd2c76389c8e5aeb44ee43618c702b9/href</a></iframe><h3><strong>Bugs Everywhere:</strong></h3><ul><li>Flutter apps are like big puzzles, full of pieces that sometimes don’t fit quite right. 🧩</li><li>Bugs are those sneaky little buggers that mess things up when we least expect it. 🐾</li></ul><h3>Chasing Bugs:</h3><ul><li>Finding bugs is like a game of hide-and-seek. We’re the seekers, and the bugs are the hiders! 🕵️‍♂️</li><li>Sometimes, it takes a bit of detective work to track down those elusive bugs and get them to come out of hiding. 🔍</li></ul><h3>Making Bugs Perform:</h3><ul><li>Reproducing bugs is like asking a mischievous pet to perform a trick. You have to get them to do it at just the right moment! 🐶</li><li>With some clever tricks like breakpoints and logging, we can coax those bugs into showing themselves in action. 🎩</li></ul><h3>Debugging is a Comedy:</h3><ul><li>Debugging is like a silly comedy show where the developers are the stars. 🤹‍♂️</li><li>We stumble through our code, making mistakes and fixing them, all while trying to keep a straight face. 😄</li></ul><h3>Tools of the Trade:</h3><ul><li>Armed with our trusty tools, we’re ready to take on any bug that comes our way. 🔧</li><li>Flutter DevTools and Stack Over flow are like our superhero sidekicks, helping us navigate the tricky world of debugging. 🦸‍♂️</li></ul><h3>Victory Lap:</h3><ul><li>Debugging can be tough, but when we finally squash that bug, it’s like winning a big game! 🏆</li><li>With a little persistence and a lot of determination, we can conquer any bug that dares to stand in our way. 💪</li></ul><h3>Celebrating Success:</h3><ul><li>Every bug squashed is a reason to celebrate! 🎉</li><li>Whether it’s a high-five with your coding buddy or a victory dance in your chair, take a moment to revel in your debugging triumphs. 💃</li></ul><h3>Onward and Upward:</h3><ul><li>As we wrap up our debugging adventure, remember that every bug encounter is an opportunity to learn and grow as developers. 🌱</li><li>So keep coding, keep debugging, and most importantly, keep having fun along the way! 🚀</li></ul><h3>Conclusion:</h3><p>So, fellow adventurers, let’s dive into the world of Flutter debugging with enthusiasm and a sense of fun! 🎉</p><p>Remember, bugs may be tricky, but with patience and a positive attitude, we can overcome any challenge that comes our way. 🌟 And if all else fails, just remember to laugh it off and keep on coding! 😊</p><p>Happy debugging, my friends! Let’s make some magic happen! ✨</p><p>Let’s Connect:</p><p><a href="https://www.linkedin.com/in/affan-minhas/">https://www.linkedin.com/in/affan-minhas/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c99687c42e10" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/lets-debug-a-fun-flutter-adventure-c99687c42e10">🐛 Let’s Debug: A Fun Flutter Adventure! 🚀</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supabase: The Latest and Fastest Database Solution for Modern Flutter Apps]]></title>
            <link>https://medium.com/blocship/supabase-the-latest-and-fastest-database-solution-for-modern-flutter-apps-a2ae76a954fc?source=rss-624198533bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2ae76a954fc</guid>
            <category><![CDATA[flutter-supabase]]></category>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[database-management]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[postgres]]></category>
            <dc:creator><![CDATA[Affan Minhas]]></dc:creator>
            <pubDate>Thu, 14 Sep 2023 10:25:33 GMT</pubDate>
            <atom:updated>2023-09-15T08:38:30.404Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQ5fX4MKtgRXba_4XVrCfw.png" /></figure><p>In today’s fast-paced digital landscape, having a robust and efficient database solution is crucial for powering modern applications. One name that’s been making waves in this space is Supabase. This article explores why Supabase is not only the latest but also one of the fastest database solutions available today. We’ll also compare it to Firebase and delve into how you can seamlessly integrate it with Flutter.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F9AaNbSShRHQQfosEOm%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F9AaNbSShRHQQfosEOm%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F9AaNbSShRHQQfosEOm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c4edc35ad5ffc9592b1daf3ad261699/href">https://medium.com/media/9c4edc35ad5ffc9592b1daf3ad261699/href</a></iframe><p>Certainly! Supabase is an exciting and innovative database solution that is gaining popularity among developers for its unique features and capabilities. Here’s an overview of what Supabase is and what makes it stand out:</p><h4><strong>1. Open Source Nature:</strong></h4><p>One of the defining features of Supabase is that it is open source. This means that the source code is freely available and can be inspected, modified, and extended by developers. This open approach ensures transparency and allows users to tailor Supabase to their specific project needs.</p><h4>2. Built on Postgres:</h4><p>Supabase is built on top of PostgreSQL, a powerful and highly respected relational database system. This choice of foundation provides Supabase with robustness, scalability, and speed. PostgreSQL is known for its performance and reliability, making it an excellent choice for demanding applications.</p><h4>3. Real-time GraphQL:</h4><p>Supabase also offers real-time GraphQL, which enables you to build powerful and flexible APIs for your applications. GraphQL allows clients to request exactly the data they need, reducing over-fetching and under-fetching of data.</p><h4>4. Integration with Popular Frameworks:</h4><p>Supabase provides SDKs and libraries for various programming languages and frameworks, making it easy to integrate with technologies like React, Angular, Vue.js, and, Flutter.</p><h3>The Need for Speed: Supabase vs. Firebase</h3><ol><li><strong>Open Source Freedom:</strong></li></ol><p>Supabase is open-source, giving you the freedom to customize and extend it as needed, without vendor lock-in. Firebase, on the other hand, can sometimes limit your flexibility due to its closed-source nature.</p><p>2. <strong>Performance:</strong></p><p>Supabase’s Postgres-based architecture is renowned for its speed and reliability, making it an ideal choice for high-performance applications. Firebase, while efficient, may not match Supabase’s raw performance in certain scenarios.</p><p>3. <strong>Real-Time Data:</strong></p><p>Supabase offers real-time data synchronization out of the box, providing instant updates to your app when data changes occur. Firebase, while capable of real-time data, often requires a more complex setup for similar functionality.</p><h3>Integrating Supabase with Flutter</h3><p>Integrating Supabase with Flutter is a seamless process, making it a popular choice for developers. Here’s a step-by-step guide:</p><ol><li><strong>Set Up Supabase Project:</strong></li></ol><p>Start by creating a Supabase project and configuring your database. This can be done via the Supabase dashboard. Go with the URL create your account and then create your first project. <a href="https://supabase.com/">https://supabase.com/</a></p><p>2. <strong>Initialize Supabase in Flutter:</strong></p><p>Use the official supabase_flutter package to initialize Supabase in your Flutter app. This package provides all the necessary tools to work with Supabase. Get it from here <a href="https://pub.dev/packages/supabase_flutter">https://pub.dev/packages/supabase_flutter</a></p><p>3. <strong>Authentication:</strong></p><p>Integrate user authentication easily with Supabase’s built-in authentication features. You can handle user sign-ups, logins, and user management effortlessly.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FHscDLzkO8EOTmgkhQP%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FHscDLzkO8EOTmgkhQP%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FHscDLzkO8EOTmgkhQP%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/21ce7c608e646ee739f172627ab4146f/href">https://medium.com/media/21ce7c608e646ee739f172627ab4146f/href</a></iframe><h4>Follow the steps:</h4><p>Import the package:</p><pre>import &#39;package:supabase_flutter/supabase_flutter.dart&#39;;</pre><p>Initialize Supabase before using it:</p><pre>import &#39;package:supabase_flutter/supabase_flutter.dart&#39;;<br><br>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br><br>  await Supabase.initialize(<br>    url: SUPABASE_URL,<br>    anonKey: SUPABASE_ANON_KEY,<br>  );<br><br>  runApp(MyApp());<br>}<br><br>// It&#39;s handy to then extract the Supabase client in a variable for later uses<br>final supabase = Supabase.instance.client;</pre><p>Authentication Example:</p><pre>final supabase = Supabase.instance.client;<br><br>// Email and password sign up<br>await supabase.auth.signUp(<br>  email: email,<br>  password: password,<br>);<br><br>// Email and password login<br>await supabase.auth.signInWithPassword(<br>  email: email,<br>  password: password,<br>);<br><br>// Magic link login<br>await supabase.auth.signInWithOtp(email: &#39;affan@flutter.com&#39;);<br><br>// Listen to auth state changes<br>supabase.auth.onAuthStateChange.listen((data) {<br>  final AuthChangeEvent event = data.event;<br>  final Session? session = data.session;<br>  // Do something when there is an auth event<br>});</pre><p>By following these steps you can easily configure supabase login and sign into your flurtter app.</p><h4>Conclusion</h4><p>In the era of instant data and real-time apps, Supabase is undoubtedly a game-changer, and its integration with Flutter makes it an even more compelling choice for modern app development. So, if you’re looking for a database solution that combines the best of speed and versatility, give Supabase a try — it might just be the key to unlocking your app’s full potential.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2ae76a954fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blocship/supabase-the-latest-and-fastest-database-solution-for-modern-flutter-apps-a2ae76a954fc">Supabase: The Latest and Fastest Database Solution for Modern Flutter Apps</a> was originally published in <a href="https://medium.com/blocship">Blocship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>