<?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 Praharsh Bhatt on Medium]]></title>
        <description><![CDATA[Stories by Praharsh Bhatt on Medium]]></description>
        <link>https://medium.com/@praharshbhatt?source=rss-9e0a4cbe8f5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lXWUn8EtvYJeKs8_7zo-kg.gif</url>
            <title>Stories by Praharsh Bhatt on Medium</title>
            <link>https://medium.com/@praharshbhatt?source=rss-9e0a4cbe8f5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:40:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@praharshbhatt/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[How To Create A Smarter Game Dialogue]]></title>
            <link>https://medium.com/multiverse-software/how-to-create-a-smarter-game-dialogue-028ba853de26?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/028ba853de26</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[game-design]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Sun, 03 May 2026 16:02:14 GMT</pubDate>
            <atom:updated>2026-05-03T16:02:14.355Z</atom:updated>
            <content:encoded><![CDATA[<p>When players talk about “choice and consequence” in games, they are usually talking about dialogue. Think of games like <em>Mass Effect</em>, <em>Dragon Age</em>, <em>Detroit: Become Human</em>, <em>Disco Elysium</em>, <em>Red Dead Redemption 2</em>, or <em>Baldur’s Gate 3</em>, where NPCs react, companions approve or disapprove, and endings shift based on what you say and do.</p><p>Under the hood, though, most of these systems are still built from fairly simple ingredients:</p><ul><li>A dialogue option sets a boolean or numeric flag.</li><li>That flag gates a later branch or changes a line.</li><li>A morality/reputation bar moves up or down and nudges a few key scenes.</li></ul><p>This works, but it is brittle and hyper-local: the game is reacting to isolated switches rather than maintaining a coherent sense of who the player has become over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*cm_COBz0eO7jrZvt.jpeg" /></figure><p>This essay sketches a different approach. Instead of scattering bespoke flags across scripts, we treat the entire playthrough as a stream of structured events feeding into a time-weighted, multi-dimensional narrative state that any system can query. Dialogue, AI, economy, factions, even difficulty can all speak a shared language about who the player is in systemic terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vLOPaUg_ewAhvz2L.png" /></figure><h3>The core abstraction: Action–Object–State</h3><p>Before we can build anything smarter, we need a common vocabulary. Every significant moment in a game — a murder, a mercy, a theft, a donation — involves three things: <em>who did what, to whom</em>. That turns out to be enough structure to build on.</p><p>We can model every meaningful interaction as an <strong>action</strong> applied to an <strong>object</strong>, producing a <strong>state contribution</strong>. The formal name for one such event is an Action Event Pipeline (AEP):</p><ul><li><strong>Action</strong>: what the player did — <em>kill, spare, help, steal, lie, confess.</em></li><li><strong>Object</strong>: who or what it was done to — <em>an NPC, a faction HQ, a village, a sacred relic.</em></li><li><strong>State contribution (Δs)</strong>: a number (or vector of numbers) describing how this event nudges the player’s narrative identity.</li></ul><p>For event <em>n</em>: <strong>AEP_n = (a_n, o_n, Δs_n)</strong></p><blockquote><strong>A note on notation</strong></blockquote><blockquote>You may notice the variables here are written as a_n, o_n, Δs_n rather than the proper typeset subscripts, this is intentional (or at least that’s what I’m telling myself). The honest reason is that most writing platforms, including the one you’re reading this on, handle subscript formatting with all the grace of a cat on a keyboard. a_n gets the point across cleanly everywhere. It means “the value of a for event number n.” You knew that already. We’re all fine.</blockquote><p>Instead of every quest designer inventing their own bespoke flags, the whole game emits AEPs into a central system. That system accumulates all those Δs values over time and exposes a snapshot the current player state S(t) that says: <em>given everything that has happened, here is what this player currently is in narrative terms.</em></p><p>Think of it like event sourcing for story. The raw log of AEPs i\aould be the ground truth. High-level labels like “notorious murderer,” “honorable knight,” or “loose cannon” are derived views computed from this log.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DxWB8dy0rQ8GUz7p.png" /></figure><h3>Quantifying morality and impact</h3><p>Now that we have a pipeline, we need to decide what actually goes into the state contribution for any given event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z0QXlIa-J4m-rahJ.jpeg" /></figure><p>This is where most existing systems give up and slap a single slider on the problem. We can do better, and it doesn’t even require anything exotic to start.</p><p>The idea is to separate <em>what you did</em> from <em>who you did it to</em>, and then combine them.</p><p>Object moral value (M_o), where M_o∈[−1,1]</p><p>Give each morally relevant character or object a baseline value on a spectrum from –1 (pure antagonist) to +1 (saint-like):</p><ul><li>–1: warlord, demon, tyrant</li><li>0: random merchant, guard, wildlife</li><li>+1: healer, beloved leader, innocent child</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4saM17sFtCKAuTz1.png" /></figure><p>Designers can hand-author these, or tooling can suggest initial values based on tags and NPC descriptions.</p><p><strong>Action impact weight (I_a)</strong></p><p>Separately, give each <em>type of action</em> a magnitude- how big a moral move is it, independent of direction?</p><p>Killing might be 0.9. Stealing might be 0.4. Lying, 0.3. Offering aid, 0.2. Minor small talk, 0.1.</p><p><strong>Combining them</strong></p><p>When a player acts, multiply the action’s impact by a function of the target’s moral value. A world where “killing evil is good, killing good is evil” might use:</p><p><strong>Δm = I_a · (–M_o)</strong></p><p>In practice:</p><ul><li>Killing a villain (M_o = –0.5) with I_kill = 0.9 gives Δm = <strong>+0.45</strong> (a positive moral move)</li><li>Killing a saint (M_o = +0.8) with I_kill = 0.9 gives Δm = <strong>–0.72</strong> (a serious moral crime)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V2oOllCl5j7YDtmp.png" /></figure><p>The specific combining function is a design surface. A pacifist world could penalize <em>any</em> killing heavily regardless of the target. A grim noir setting might be tolerant of violence but harsh on betrayal. The point is that every event now has a composable, well-defined contribution to the player’s state, rather than an ad-hoc script.</p><p>This means the very similar play styles can have more possibilities than it’s possible to easily count; making re- plays have more variance.</p><p>The specific function <em>g</em>(⋅) is a design surface: a pacifist world could penalize any killing heavily, or a grim setting could be more tolerant of brutality.</p><p>The important part is that <strong>every AEP carries a well-defined, composable contribution</strong> instead of ad-hoc one-off script logic.</p><h3>Time-weighted moral history: redemption and decay</h3><p>Here’s a problem that single-slider systems almost always get wrong: your first hour of play shouldn’t define your last. If a player murders their way through Act 1, then spends Acts 2 and 3 being genuinely heroic, the world should be <em>able</em> to notice that shift. Conversely, a seemingly good character who suddenly starts making dark choices should raise flags and not get a free pass because their old score is high.</p><p>The fix is to weight events by recency. Instead of just summing all past Δm values equally, we apply a decay function so that older events contribute less than recent ones.</p><p>A natural choice is <strong>exponential decay</strong>:<br><strong>w(t, t_n) = λ^(t — t_n)</strong></p><p>where:</p><ul><li><em>t</em> is the current moment (could be event count, quest milestones, or in-game days)</li><li><em>t_n</em> is when event <em>n</em> happened</li><li><em>λ</em> is a decay rate between 0 and 1</li></ul><p>With λ close to 1, the world has a long memory and history matters a lot. With smaller λ, recent actions dominate and the world is quicker to update its opinion of you.</p><p>The current moral score is then a weighted average of all past impacts:</p><p><strong>M_player(t) = Σ w(t, t_n) · Δm_n / Σ w(t, t_n)</strong></p><p>In practice, it’s useful to maintain <em>two</em> windows simultaneously, a long-memory lifetime score and a short-window recent score. Dialogue and systems can then distinguish between who the player has usually been and who they seem to be <em>becoming</em> lately. That distinction is what unlocks credible redemption arcs, sudden heel-turns, and gradual corruption, without any hard-coded special cases.</p><h3>From a single slider to a state vector</h3><p>Even a well-tuned, time-weighted morality score is still just one axis. Real people are more complicated than that- and so are interesting characters. A player can be kind but unreliable, loyal but brutal, lawful yet deeply selfish, or chaotic but fiercely protective of people they care about. A single good–evil slider collapses all of that into a single number, which is part of why most morality systems feel shallow.</p><p>The solution is to track the player as a <strong>vector</strong> of behavioral dimensions, not a single scalar:</p><p><strong>S(t) = [morality, honor, loyalty, chaos, mercy, faction_X_reputation, …]</strong></p><p>Each component tracks a different axis of identity. Each action–object pair now yields a <em>vector</em> contribution ΔS_n- nudging multiple dimensions at once. Stealing from a temple might hurt your morality and your reputation with a religious faction, but possibly increase your chaos score. Defecting from the thieves’ guild might drop your loyalty score sharply while improving your standing with law-abiding factions.</p><p>The time-weighted aggregation works exactly the same way, just applied across every dimension:</p><p><strong>S(t) = Σ w(t, t_n) · ΔS_n / Σ w(t, t_n)</strong></p><p>The practical payoff, as mentioned before will be that no two players who play differently are likely to end up with the same state vector. Their identity fingerprints will diverge- and systems across the game can react to those differences in principled, consistent ways.</p><h3>Keeping authoring sane: tools, tags, and personas</h3><p>At this point a reasonable objection is: specifying the full state contribution vector for every action–object combination sounds like an enormous amount of work. Won’t that explode the authoring burden?</p><p>It doesn’t have to, if you structure it correctly. The key insight is that most objects and actions can be described with a small set of semantic <em>tags</em>- things like “values loyalty,” “abhors betrayal,” “holy relic,” “minor theft,” “armed civilian.” Rule-based templates or lightweight learned models can propose default state contributions from those tags, which designers then review, tweak, and lock in. You get predictability and editorial control without hand-crafting a full table from scratch.</p><p>For the trickiest cases- novel action–object combinations that weren’t anticipated at authoring time- transformer-based text encoders can embed both the action description and the NPC description into a shared space and estimate a reasonable ΔS. Designers can always override these estimates with hard rules (”killing any child is always maximally penalized, regardless of the model’s output”).</p><h3>Feeding the state into dialogue</h3><p>Once the state model exists, dialogue becomes the most immediate consumer. Traditional dialogue trees gate branches on simple conditions- “has item,” “finished quest,” “morality above 50.” A richer state allows conditions that actually say something:</p><ul><li>“High mercy, recently spiked in chaos” → an NPC senses the contradiction and calls it out</li><li>“Historically cruel but improving lately” → a reformed mentor gives a cautious second chance</li><li>“Trusted by faction A, distrusted by faction B” → a joint meeting becomes genuinely tense</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VVW3ln0iL0lNWqDU.jpeg" /></figure><p>Writers author a handful of variants keyed to broad regions of state space- “trusted ally,” “feared loose cannon,” “distrusted opportunist”- rather than trying to branch for every possible combination. Before selecting a variant, the system maps the continuous state vector into a small scene-specific persona set. A given conversation might only distinguish three or four roles; the system picks the best fit and falls back to a neutral default when nothing special applies.</p><h3>Beyond dialogue: systemic consequences</h3><p>Dialogue is the most visible output of a shared narrative state, but it’s far from the only one. Once you have a single authoritative answer to “who is this player right now,” every other system in the game can ask it.</p><p><strong>Difficulty</strong> can respond diegetically instead of via invisible rubber-banding. Infamous or chaotic players attract more ambushes, bounty hunters, and armed patrols. Respected heroes receive timely backup from guards or allies during tough encounters. The world feels like it’s <em>reacting</em> rather than quietly tweaking numbers behind the scenes.</p><p><strong>Economy and access</strong> can reflect reputation. Generous, well-regarded characters get better prices and invitations to exclusive markets. Notorious thieves or serial betrayers face inflated prices, restricted stock, or outright refusal.</p><p><strong>Faction politics and world state</strong> can evolve from the same foundation. Repeated betrayals could trigger a leadership change. Regions might tighten their laws or increase patrols in response to rising chaos. Because all of this draws from the same action–object–state machinery, the world’s reactions feel coherent across systems rather than disconnected.</p><h3>Production reality: a hybrid model</h3><p>All this is purely a though experiment, until it’s put to practical use, and genuinely works. Real productions also live under real constraints, cinematics are expensive, well authored character narrations are finite, and hence, a fully procedural narrative is not only seemimgly endless work to get supported by assets, but it can also drift off tone or break character consistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xsj2XEX6k5ve5zBE.png" /></figure><p>As I always say while architecting, the most practical path is a layered hybrid. One can have:</p><ol><li><strong>Systemic backbone.</strong> A central service logs action–object events, maintains the state vector, and exposes buckets and personas to any consumer system. It runs quietly throughout the entire game.</li><li><strong>Authored anchors.</strong> Limited core story beats, pivotal scenes, and key character moments remain hand-crafted and fire under broad, interpretable conditions. These don’t change.</li><li><strong>Parametric variation layer.</strong> Between those anchors, the shared state governs which minor quest variants surface, which line readings play, how guards and civilians respond, and what kinds of trouble seek the player out. Writers author a small set of persona-keyed variants per scene rather than endless bespoke branches.</li></ol><p>This can allow a title to be played in the contraints that is reasonably expected from a character, while still computing the result of the actions using our new approach. We’d end up defining a scale for non descrete player states at the time of desicion making.</p><h3>Why this matters</h3><p>This architecture doesn’t remove the need for writers, neither does it magically generate good stories. My goal is to have a system of reliable outputs, which can be listened to, to get highly accurate data projecting player’s decisions rather than depending on a combination of limited boolean values. This gives the writers the choice of how finely do they want the game world to be reflected with respect to player’s past / current actions.</p><p>Long-term behavior also becomes <em>visible</em> across the game. Multi-dimensional identity replaces the karma bar. Because the state is explicitly time-aware, the world can support credible redemption, slow corruption, loyalty, and betrayal arcs without resorting to one-off exceptions written into individual quest scripts.</p><p>From the player’s perspective, the promise is simple. When an NPC calls you out, praises you, or clearly fears you, it’s not just because you picked the red option in the last conversation. It’s because the world has been quietly keeping score across everything you’ve done; and it’s finally telling you what it thinks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=028ba853de26" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multiverse-software/how-to-create-a-smarter-game-dialogue-028ba853de26">How To Create A Smarter Game Dialogue</a> was originally published in <a href="https://medium.com/multiverse-software">Multiverse Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything about Tree traversal- Inorder, preorder, postorder, time complexity with code]]></title>
            <link>https://praharshbhatt.medium.com/everything-about-tree-traversal-inorder-preorder-postorder-time-complexity-with-code-2f4de533277f?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f4de533277f</guid>
            <category><![CDATA[competetive-programming]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[trees]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Mon, 10 Jan 2022 12:59:59 GMT</pubDate>
            <atom:updated>2022-01-10T12:59:59.618Z</atom:updated>
            <content:encoded><![CDATA[<h3>Definition</h3><p>Unlike linear data structures (Array, Linked List, Queues, Stacks, etc) which have only one logical way to traverse them, trees can be traversed in different ways. Following are the generally used ways for traversing trees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*cxXPgxw5imaniGnNScef5g.jpeg" /></figure><p>In [21]:</p><pre><em># A class that represents an individual node in a</em><br><em># Binary Tree</em><br></pre><pre><strong>class</strong> Node:<br>    <strong>def</strong> __init__(self, key):<br>        self<strong>.</strong>left <strong>=</strong> <strong>None</strong><br>        self<strong>.</strong>right <strong>=</strong> <strong>None</strong><br>        self<strong>.</strong>data <strong>=</strong> key</pre><h3>Ways of traversals</h3><p>Trees are traversed in the following ways:</p><ol><li>Depth First Traversals:</li><li>Inorder (Left, Root, Right) : 4 2 5 1 3</li><li>Preorder (Root, Left, Right) : 1 2 4 5 3</li><li>Postorder (Left, Right, Root) : 4 5 2 3 1</li><li>Breadth-First or Level Order Traversal: 1 2 3 4 5</li></ol><p>In [22]:</p><pre><em># Function to perform inorder traversal on the BST</em><br><strong>def</strong> inorder(root):<br>    <strong>if</strong> root <strong>is</strong> <strong>None</strong>:<br>        <strong>return</strong></pre><pre>    inorder(root<strong>.</strong>left)<br>    print(root<strong>.</strong>data, end<strong>=</strong>&quot; &quot;)<br>    inorder(root<strong>.</strong>right)</pre><h3>Inorder Traversal</h3><p><strong>Explanation</strong></p><ol><li>Traverse the left subtree, i.e., call Inorder(left-subtree)</li><li>Visit the root.</li><li>Traverse the right subtree, i.e., call Inorder(right-subtree)</li></ol><p>A new key is always inserted at the leaf. We start searching a key from the root until we hit a leaf node. Once a leaf node is found, the new node is added as a child of the leaf node.</p><p><strong>Time Complexity</strong></p><p>O(n)</p><p>Let us see different corner cases. Complexity function T(n) — for all problems where tree traversal is involved — can be defined as: T(n) = T(k) + T(n — k — 1) + c Where k is the number of nodes on one side of the root and n-k-1 on the other side. Let’s do an analysis of boundary conditions Case 1: Skewed tree (One of the subtrees is empty and another subtree is non-empty ) k is 0 in this case. T(n) = T(0) + T(n-1) + c T(n) = 2T(0) + T(n-2) + 2c T(n) = 3T(0) + T(n-3) + 3c T(n) = 4T(0) + T(n-4) + 4c ………………………………………… …………………………………………. T(n) = (n-1)T(0) + T(1) + (n-1)c T(n) = nT(0) + (n)c Value of T(0) will be some constant say d. (traversing an empty tree will take some constants time) T(n) = n(c+d) T(n) = Θ(n) (Theta of n) Case 2: Both left and right subtrees have an equal number of nodes. T(n) = 2T(|<em>n/2</em>|) + c This recursive function is in the standard form (T(n) = aT(n/b) + (-)(n) ) for master method <a href="http://en.wikipedia.org/wiki/Master_theorem">http://en.wikipedia.org/wiki/Master_theorem</a>. If we solve it by master method we get (-)(n)</p><p><strong>Space Complexity</strong></p><p>If we don’t consider the size of the stack for function calls then O(1). Otherwise, O(h) where h is the height of the tree.</p><p>The height of the skewed tree is n (no. of elements) so the worst space complexity is O(n). Height is (Log n) for the balanced tree so the best space complexity is O(Log n).</p><p><strong>Uses</strong> In the case of binary search trees (BST), Inorder traversal gives nodes in non-decreasing order. To get nodes of BST in non-increasing order, a variation of Inorder traversal where Inorder traversal s reversed can be used.</p><p>Example: In order traversal for the above-given figure is 4 2 5 1 3.</p><h3>Inorder Traversal</h3><p><strong>Explanation</strong></p><ol><li>Traverse the left subtree, i.e., call Inorder(left-subtree)</li><li>Visit the root.</li><li>Traverse the right subtree, i.e., call Inorder(right-subtree)</li></ol><p>A new key is always inserted at the leaf. We start searching a key from the root until we hit a leaf node. Once a leaf node is found, the new node is added as a child of the leaf node.</p><p><strong>Time Complexity</strong></p><p>O(n)</p><p>Let us see different corner cases. Complexity function T(n) — for all problems where tree traversal is involved — can be defined as: T(n) = T(k) + T(n — k — 1) + c Where k is the number of nodes on one side of the root and n-k-1 on the other side. Let’s do an analysis of boundary conditions Case 1: Skewed tree (One of the subtrees is empty and another subtree is non-empty ) k is 0 in this case. T(n) = T(0) + T(n-1) + c T(n) = 2T(0) + T(n-2) + 2c T(n) = 3T(0) + T(n-3) + 3c T(n) = 4T(0) + T(n-4) + 4c ………………………………………… …………………………………………. T(n) = (n-1)T(0) + T(1) + (n-1)c T(n) = nT(0) + (n)c Value of T(0) will be some constant say d. (traversing an empty tree will take some constants time) T(n) = n(c+d) T(n) = Θ(n) (Theta of n) Case 2: Both left and right subtrees have an equal number of nodes. T(n) = 2T(|<em>n/2</em>|) + c This recursive function is in the standard form (T(n) = aT(n/b) + (-)(n) ) for master method <a href="http://en.wikipedia.org/wiki/Master_theorem">http://en.wikipedia.org/wiki/Master_theorem</a>. If we solve it by master method we get (-)(n)</p><p><strong>Space Complexity</strong></p><p>If we don’t consider the size of the stack for function calls then O(1). Otherwise, O(h) where h is the height of the tree.</p><p>The height of the skewed tree is n (no. of elements) so the worst space complexity is O(n). Height is (Log n) for the balanced tree so the best space complexity is O(Log n).</p><p><strong>Uses</strong> In the case of binary search trees (BST), Inorder traversal gives nodes in non-decreasing order. To get nodes of BST in non-increasing order, a variation of Inorder traversal where Inorder traversal s reversed can be used.</p><p>Example: In order traversal for the above-given figure is 4 2 5 1 3.</p><p>In [23]:</p><pre><em># A function to do inorder tree traversal</em><br><strong>def</strong> printInorder(root):<br> <br>    <strong>if</strong> root:<br> <br>        <em># First recur on left child</em><br>        printInorder(root<strong>.</strong>left)<br> <br>        <em># then print the data of node</em><br>        print(root<strong>.</strong>data),<br> <br>        <em># now recur on right child</em><br>        printInorder(root<strong>.</strong>right)<br> <br> <br><em># Driver code</em><br>root <strong>=</strong> Node(1)<br>root<strong>.</strong>left <strong>=</strong> Node(2)<br>root<strong>.</strong>right <strong>=</strong> Node(3)<br>root<strong>.</strong>left<strong>.</strong>left <strong>=</strong> Node(4)<br>root<strong>.</strong>left<strong>.</strong>right <strong>=</strong> Node(5)</pre><pre>print (&quot;\nThe Inorder traversal of binary tree is&quot;)<br>printInorder(root)</pre><pre>The Inorder traversal of binary tree is<br>4<br>2<br>5<br>1<br>3</pre><h3>PreOrder Traversal</h3><p><strong>Explanation</strong></p><ol><li>Visit the root.</li><li>Traverse the left subtree, i.e., call PreOrder(left-subtree)</li><li>Traverse the right subtree, i.e., call PreOrder(right-subtree)</li></ol><p><strong>Time Complexity</strong></p><p>O(n)</p><p>Let us see different corner cases. Complexity function T(n) — for all problems where tree traversal is involved — can be defined as: T(n) = T(k) + T(n — k — 1) + c Where k is the number of nodes on one side of the root and n-k-1 on the other side. Let’s do an analysis of boundary conditions Case 1: Skewed tree (One of the subtrees is empty and another subtree is non-empty ) k is 0 in this case. T(n) = T(0) + T(n-1) + c T(n) = 2T(0) + T(n-2) + 2c T(n) = 3T(0) + T(n-3) + 3c T(n) = 4T(0) + T(n-4) + 4c ………………………………………… …………………………………………. T(n) = (n-1)T(0) + T(1) + (n-1)c T(n) = nT(0) + (n)c Value of T(0) will be some constant say d. (traversing an empty tree will take some constants time) T(n) = n(c+d) T(n) = Θ(n) (Theta of n) Case 2: Both left and right subtrees have an equal number of nodes. T(n) = 2T(|<em>n/2</em>|) + c This recursive function is in the standard form (T(n) = aT(n/b) + (-)(n) ) for master method <a href="http://en.wikipedia.org/wiki/Master_theorem">http://en.wikipedia.org/wiki/Master_theorem</a>. If we solve it by master method we get (-)(n)</p><p><strong>Space Complexity</strong></p><p>If we don’t consider the size of the stack for function calls then O(1). Otherwise, O(h) where h is the height of the tree.</p><p>The height of the skewed tree is n (no. of elements) so the worst space complexity is O(n). Height is (Log n) for the balanced tree so the best space complexity is O(Log n).</p><p><strong>Uses</strong></p><p>Preorder traversal is used to create a copy of the tree. Preorder traversal is also used to get prefix expression on an expression tree. Please see <a href="http://en.wikipedia.org/wiki/Polish_notation">http://en.wikipedia.org/wiki/Polish_notation</a> know why prefix expressions are useful.</p><p>Example: Preorder traversal for the above-given figure is 1 2 4 5 3.</p><p>In [24]:</p><pre><em># A function to do preorder tree traversal</em><br><strong>def</strong> printPreorder(root):<br> <br>    <strong>if</strong> root:<br> <br>        <em># First print the data of node</em><br>        print(root<strong>.</strong>data),<br> <br>        <em># Then recur on left child</em><br>        printPreorder(root<strong>.</strong>left)<br> <br>        <em># Finally recur on right child</em><br>        printPreorder(root<strong>.</strong>right)<br>        <br>        <br><em># Driver code</em><br>root <strong>=</strong> Node(1)<br>root<strong>.</strong>left <strong>=</strong> Node(2)<br>root<strong>.</strong>right <strong>=</strong> Node(3)<br>root<strong>.</strong>left<strong>.</strong>left <strong>=</strong> Node(4)<br>root<strong>.</strong>left<strong>.</strong>right <strong>=</strong> Node(5)</pre><pre>print (&quot;\nThe Inorder traversal of binary tree is&quot;)<br>printPreorder(root)</pre><pre>The Inorder traversal of binary tree is<br>1<br>2<br>4<br>5<br>3</pre><p>In [25]:</p><pre><em># A function to do postorder tree traversal</em><br><strong>def</strong> printPostorder(root):<br> <br>    <strong>if</strong> root:<br> <br>        <em># First recur on left child</em><br>        printPostorder(root<strong>.</strong>left)<br> <br>        <em># the recur on right child</em><br>        printPostorder(root<strong>.</strong>right)<br> <br>        <em># now print the data of node</em><br>        print(root<strong>.</strong>data),<br>        <br><em># Driver code</em><br>root <strong>=</strong> Node(1)<br>root<strong>.</strong>left <strong>=</strong> Node(2)<br>root<strong>.</strong>right <strong>=</strong> Node(3)<br>root<strong>.</strong>left<strong>.</strong>left <strong>=</strong> Node(4)<br>root<strong>.</strong>left<strong>.</strong>right <strong>=</strong> Node(5)</pre><pre>print (&quot;\nThe Inorder traversal of binary tree is&quot;)<br>printPostorder(root)</pre><pre>The Inorder traversal of binary tree is<br>4<br>5<br>2<br>3<br>1</pre><h3>Breadth first traversal</h3><p><strong>Methods</strong></p><ol><li>Use function to print a current level</li><li>Using queue</li></ol><h3>Method 1 (Use function to print a current level)</h3><p><strong>Expatiation</strong></p><p>There are basically two functions in this method. One is to print all nodes at a given level (printCurrentLevel), and other is to print level order traversal of the tree (printLevelorder). printLevelorder makes use of printCurrentLevel to print nodes at all levels one by one starting from the root.</p><p><strong>Time Complexity</strong></p><p>O(n²) in worst case. For a skewed tree, printGivenLevel() takes O(n) time where n is the number of nodes in the skewed tree. So time complexity of printLevelOrder() is O(n) + O(n-1) + O(n-2) + .. + O(1) which is O(n²).</p><p><strong>Space Complexity</strong></p><p>O(n) in worst case. For a skewed tree, printGivenLevel() uses O(n) space for call stack. For a Balanced tree, the call stack uses O(log n) space, (i.e., the height of the balanced tree).</p><p>In [26]:</p><pre><em># Recursive Python program for level</em><br></pre><pre><em># Function to  print level order traversal of tree</em><br><strong>def</strong> printLevelOrder(root):<br>    h <strong>=</strong> height(root)<br>    <strong>for</strong> i <strong>in</strong> range(1, h<strong>+</strong>1):<br>        printCurrentLevel(root, i)<br></pre><pre><em># Print nodes at a current level</em><br><strong>def</strong> printCurrentLevel(root, level):<br>    <strong>if</strong> root <strong>is</strong> <strong>None</strong>:<br>        <strong>return</strong><br>    <strong>if</strong> level <strong>==</strong> 1:<br>        print(root<strong>.</strong>data, end<strong>=</strong>&quot; &quot;)<br>    <strong>elif</strong> level <strong>&gt;</strong> 1:<br>        printCurrentLevel(root<strong>.</strong>left, level<strong>-</strong>1)<br>        printCurrentLevel(root<strong>.</strong>right, level<strong>-</strong>1)<br></pre><pre>&quot;&quot;&quot; Compute the height of a tree--the number of nodes<br>    along the longest path from the root node down to<br>    the farthest leaf node<br>&quot;&quot;&quot;<br></pre><pre><strong>def</strong> height(node):<br>    <strong>if</strong> node <strong>is</strong> <strong>None</strong>:<br>        <strong>return</strong> 0<br>    <strong>else</strong>:<br>        <em># Compute the height of each subtree</em><br>        lheight <strong>=</strong> height(node<strong>.</strong>left)<br>        rheight <strong>=</strong> height(node<strong>.</strong>right)</pre><pre>        <em># Use the larger one</em><br>        <strong>if</strong> lheight <strong>&gt;</strong> rheight:<br>            <strong>return</strong> lheight<strong>+</strong>1<br>        <strong>else</strong>:<br>            <strong>return</strong> rheight<strong>+</strong>1<br></pre><pre><em># Driver program to test above function</em><br>root <strong>=</strong> Node(1)<br>root<strong>.</strong>left <strong>=</strong> Node(2)<br>root<strong>.</strong>right <strong>=</strong> Node(3)<br>root<strong>.</strong>left<strong>.</strong>left <strong>=</strong> Node(4)<br>root<strong>.</strong>left<strong>.</strong>right <strong>=</strong> Node(5)</pre><pre>print(&quot;Level order traversal of binary tree is -&quot;)<br>printLevelOrder(root)</pre><pre>Level order traversal of binary tree is -<br>1 2 3 4 5</pre><h3>Method 2 (Using queue)</h3><p><strong>Expatiation</strong></p><p>For each node, first the node is visited and then it’s child nodes are put in a FIFO queue.</p><p><strong>Time Complexity</strong></p><p>O(n²) in worst case. For a skewed tree, printGivenLevel() takes O(n) time where n is the number of nodes in the skewed tree. So time complexity of printLevelOrder() is O(n) + O(n-1) + O(n-2) + .. + O(1) which is O(n²).</p><p><strong>Space Complexity</strong></p><p>O(n) in worst case. For a skewed tree, printGivenLevel() uses O(n) space for call stack. For a Balanced tree, the call stack uses O(log n) space, (i.e., the height of the balanced tree).</p><p>In [27]:</p><pre><em># order traversal using Queue</em><br><strong>def</strong> printLevelOrder(root):<br>    <em># Base Case</em><br>    <strong>if</strong> root <strong>is</strong> <strong>None</strong>:<br>        <strong>return</strong></pre><pre>    <em># Create an empty queue</em><br>    <em># for level order traversal</em><br>    queue <strong>=</strong> []</pre><pre>    <em># Enqueue Root and initialize height</em><br>    queue<strong>.</strong>append(root)</pre><pre>    <strong>while</strong> len(queue) <strong>&gt;</strong> 0:</pre><pre>        <em># Print front of queue and</em><br>        <em># remove it from queue</em><br>        print(queue[0]<strong>.</strong>data)<br>        node <strong>=</strong> queue<strong>.</strong>pop(0)</pre><pre>        <em># Enqueue left child</em><br>        <strong>if</strong> node<strong>.</strong>left <strong>is</strong> <strong>not</strong> <strong>None</strong>:<br>            queue<strong>.</strong>append(node<strong>.</strong>left)</pre><pre>        <em># Enqueue right child</em><br>        <strong>if</strong> node<strong>.</strong>right <strong>is</strong> <strong>not</strong> <strong>None</strong>:<br>            queue<strong>.</strong>append(node<strong>.</strong>right)</pre><pre><em># Function to  print level order traversal of tree</em><br><strong>def</strong> printLevelOrder(root):<br>    h <strong>=</strong> height(root)<br>    <strong>for</strong> i <strong>in</strong> range(1, h<strong>+</strong>1):<br>        printCurrentLevel(root, i)<br></pre><pre><em># Driver Program to test above function</em><br>root <strong>=</strong> Node(1)<br>root<strong>.</strong>left <strong>=</strong> Node(2)<br>root<strong>.</strong>right <strong>=</strong> Node(3)<br>root<strong>.</strong>left<strong>.</strong>left <strong>=</strong> Node(4)<br>root<strong>.</strong>left<strong>.</strong>right <strong>=</strong> Node(5)</pre><pre>print(&quot;Level Order Traversal of binary tree is -&quot;)<br>printLevelOrder(root)<br><em># This code is contributed by Nikhil Kumar Singh(nickzuck_007)</em></pre><pre>Level Order Traversal of binary tree is -<br>1 2 3 4 5</pre><pre>Complete code: <a href="https://github.com/praharshbhatt/ds_algo_leetcode/blob/master/notes/concepts/tree_traversals/tree_traversals.ipynb">https://github.com/praharshbhatt/ds_algo_leetcode/blob/master/notes/concepts/tree_traversals/tree_traversals.ipynb</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f4de533277f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything about binary search trees- Insertion, Deletion, searching, time complexity]]></title>
            <link>https://praharshbhatt.medium.com/everything-about-binary-search-trees-insertion-deletion-searching-time-complexity-b1fd42976e77?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1fd42976e77</guid>
            <category><![CDATA[binary-tree-traversal]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[competetive-programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[binary-tree]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Sun, 09 Jan 2022 16:28:20 GMT</pubDate>
            <atom:updated>2022-01-09T16:31:07.442Z</atom:updated>
            <content:encoded><![CDATA[<h3>Definition</h3><p>A binary search tree (BST), also called an ordered or sorted binary tree, is a rooted binary tree data structure whose internal nodes each store a key greater than all the keys in the node’s left subtree and less than those in its right subtree.</p><p>A binary tree is a type of data structure for storing data such as numbers in an organized way. Binary search trees allow binary search for fast lookup, addition and removal of data items, and can be used to implement dynamic sets and lookup tables.</p><p>The order of nodes in a BST means that each comparison skips about half of the remaining tree, so the whole lookup takes time proportional to the binary logarithm of the number of items stored in the tree. This is much better than the linear time required to find items by key in an (unsorted) array but slower than the corresponding operations on hash tables. Several variants of the binary search tree have been studied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FR3OjMIMMOuPTU1TlavlVg.png" /></figure><p>In [21]:</p><pre><em># A class to store a BST node</em><br><strong>class</strong> Node:<br>    <strong>def</strong> __init__(self, data, left<strong>=None</strong>, right<strong>=None</strong>):<br>        self<strong>.</strong>data <strong>=</strong> data<br>        self<strong>.</strong>left <strong>=</strong> left<br>        self<strong>.</strong>right <strong>=</strong> right<br></pre><pre><em># Function to perform inorder traversal on the BST</em><br><strong>def</strong> inorder(root):<br>    <strong>if</strong> root <strong>is</strong> <strong>None</strong>:<br>        <strong>return</strong></pre><pre>    inorder(root<strong>.</strong>left)<br>    print(root<strong>.</strong>data, end<strong>=</strong>&quot; &quot;)<br>    inorder(root<strong>.</strong>right)</pre><h3>Operations and time complexity</h3><p>Binary search trees support three main operations:</p><ol><li>Searching: For searching, we have to traverse all elements (assuming we do breadth-first traversal). Therefore, searching in a binary tree has worst-case complexity of O(n).</li><li>Insertion: For inserting, we have to traverse all elements. Therefore, insertion in a binary tree has worst-case complexity of O(n).</li><li>Deletion: For deletion, we have to traverse all elements to find 2 (assuming we do breadth first traversal). Therefore, deletion in binary tree has worst case complexity of O(n)</li></ol><p>The latter two possibly change the structural arrangement of the nodes in the tree, whereas the first one is a navigating and read-only operation. Other read-only operations are traversal, verification, etc.</p><h3>Insertion</h3><p>A new key is always inserted at the leaf. We start searching a key from the root until we hit a leaf node. Once a leaf node is found, the new node is added as a child of the leaf node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*CjTC-LnGtgUZ0FBmOVi3Dg.gif" /></figure><p>Binary search tree (BST)In [22]:</p><pre><em># Recursive function to insert a key into a BST</em><br><strong>def</strong> insert(root, key):<br> <br>    <em># if the root is None, create a new node and return it</em><br>    <strong>if</strong> root <strong>is</strong> <strong>None</strong>:<br>        <strong>return</strong> Node(key)<br> <br>    <em># if the given key is less than the root node, recur for the left subtree</em><br>    <strong>if</strong> key <strong>&lt;</strong> root<strong>.</strong>data:<br>        root<strong>.</strong>left <strong>=</strong> insert(root<strong>.</strong>left, key)<br> <br>    <em># if the given key is more than the root node, recur for the right subtree</em><br>    <strong>else</strong>:<br>        root<strong>.</strong>right <strong>=</strong> insert(root<strong>.</strong>right, key)<br> <br>    <strong>return</strong> root<br>    </pre><pre>keys <strong>=</strong> [21, 28, 14, 32, 25, 18, 11, 30, 19, 15, 23, 27]<br>root <strong>=</strong> <strong>None</strong><br><strong>for</strong> key <strong>in</strong> keys:<br>    root <strong>=</strong> insert(root, key)<br>    <br>inorder(root)</pre><pre>11 14 15 18 19 21 23 25 27 28 30 32</pre><h3>Searching</h3><p>Searching in a binary search tree for a specific key can be programmed recursively or iteratively.</p><p>We begin by examining the root node. If the tree is empty, the key we are searching for does not exist in the tree. Otherwise, if the key equals that of the root, the search is successful and we return the node.</p><p>If the key is less than that of the root, we search the left subtree. Similarly, if the key is greater than that of the root, we search the right subtree.</p><p>This process is repeated until the key is found or the remaining subtree is empty. If the searched key is not found after a empty subtree is reached, then the key is not present in the tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*OmRV7P0YluY2ToRj44jKGA.gif" /></figure><p>This algorithm searches from the tree’s root to the leaf farthest from the root in the worst-case. The search operation takes time proportional to the tree’s height. On average, binary search trees with n nodes have O(log(n)) height. However, in the worst case, binary search trees can have O(n) height (for skewed trees where all the nodes except the leaf have one and only one child) when the unbalanced tree resembles a linked list.</p><p>The space used by the call stack is also proportional to the tree’s height. The algorithm can be implemented iteratively to avoid use of extra space.</p><p>In [23]:</p><pre><em># Recursive function to search in a given BST (BFS)</em><br><strong>def</strong> search(root, key, parent):<br> <br>    <em># if the key is not present in the key</em><br>    <strong>if</strong> root <strong>is</strong> <strong>None</strong>:<br>        print(&#39;Key not found&#39;)<br>        <strong>return</strong><br> <br>    <em># if the key is found</em><br>    <strong>if</strong> root<strong>.</strong>data <strong>==</strong> key:<br> <br>        <strong>if</strong> parent <strong>is</strong> <strong>None</strong>:<br>            print(f&#39;The node with key {key} is root node&#39;)<br>        <strong>elif</strong> key <strong>&lt;</strong> parent<strong>.</strong>data:<br>            print(&#39;The given key is the left node of the node with key&#39;, parent<strong>.</strong>data)<br>        <strong>else</strong>:<br>            print(&#39;The given key is the right node of the node with key&#39;, parent<strong>.</strong>data)<br> <br>        <strong>return</strong><br> <br>    <em># if the given key is less than the root node, recur for the left subtree;</em><br>    <em># otherwise, recur for the right subtree</em><br> <br>    <strong>if</strong> key <strong>&lt;</strong> root<strong>.</strong>data:<br>        search(root<strong>.</strong>left, key, root)<br>    <strong>else</strong>:<br>        search(root<strong>.</strong>right, key, root)<br> <br> <br>search(root, 27, <strong>None</strong>)</pre><pre>The given key is the right node of the node with key 25</pre><p>In [24]:</p><pre><em># Iterative function to search in a given BST (DFS)</em><br><strong>def</strong> searchIterative(root, key):<br> <br>    <em># start with the root node</em><br>    curr <strong>=</strong> root<br> <br>    <em># pointer to store the parent of the current node</em><br>    parent <strong>=</strong> <strong>None</strong><br> <br>    <em># traverse the tree and search for the key</em><br>    <strong>while</strong> curr <strong>and</strong> curr<strong>.</strong>data <strong>!=</strong> key:<br> <br>        <em># update the parent to the current node</em><br>        parent <strong>=</strong> curr<br> <br>        <em># if the given key is less than the current node, go to the left subtree;</em><br>        <em># otherwise, go to the right subtree</em><br>        <strong>if</strong> key <strong>&lt;</strong> curr<strong>.</strong>data:<br>            curr <strong>=</strong> curr<strong>.</strong>left<br>        <strong>else</strong>:<br>            curr <strong>=</strong> curr<strong>.</strong>right<br> <br>    <em># if the key is not present in the key</em><br>    <strong>if</strong> curr <strong>is</strong> <strong>None</strong>:<br>        print(&#39;Key not found&#39;)<br>        <strong>return</strong><br> <br>    <strong>if</strong> parent <strong>is</strong> <strong>None</strong>:<br>        print(f&#39;The node with key {key} is root node&#39;)<br>    <strong>elif</strong> key <strong>&lt;</strong> parent<strong>.</strong>data:<br>        print(&#39;The given key is the left node of the node with key&#39;, parent<strong>.</strong>data)<br>    <strong>else</strong>:<br>        print(&#39;The given key is the right node of the node with key&#39;, parent<strong>.</strong>data)<br> <br> <br>searchIterative(root, 27)</pre><pre>The given key is the right node of the node with key 25</pre><h3>Deletion</h3><p>Here are three possible cases to consider deleting a node from BST:</p><p>Case 1: Deleting a node with no children: remove the node from the tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*sSnGnZJ60TKSJf49yTlzGA.png" /></figure><p>Case 2: Deleting a node with two children: call the node to be deleted N. Do not delete N. Instead, choose either its inorder successor (The smallest number in the right subtree) node or its inorder predecessor node (The biggest number in the left subtree), R. Copy the value of R to N, then recursively call delete on R until reaching one of the first two cases. If we choose the inorder successor of a node (The smallest number in the right subtree), as the right subtree is not NULL (our present case is a node with 2 children), then its inorder successor is a node with the least value in its right subtree, which will have at a maximum of 1 subtree, so deleting it would fall in one of the first 2 cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*NX8cnS3pKxrLeRe0vtpBzw.png" /></figure><p>Case 3: Deleting a node with one child: remove the node and replace it with its child.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*jhl-5DlgTS61n7Ta8akDIg.png" /></figure><p>Broadly speaking, nodes with children are harder to delete. As with all binary trees, a node’s inorder successor is its right subtree’s leftmost child, and a node’s inorder predecessor is the left subtree’s rightmost child. In either case, this node will have zero or one child. Delete it according to one of the two simpler cases above.</p><p>In [25]:</p><pre><em># Helper function to find minimum value node in the subtree rooted at `curr`</em><br><strong>def</strong> getMinimumKey(curr):<br>    <strong>while</strong> curr<strong>.</strong>left:<br>        curr <strong>=</strong> curr<strong>.</strong>left<br>    <strong>return</strong> curr<br></pre><pre><em># Function to delete a node from a BST</em><br><strong>def</strong> deleteNode(root, key):</pre><pre>    <em># pointer to store the parent of the current node</em><br>    parent <strong>=</strong> <strong>None</strong></pre><pre>    <em># start with the root node</em><br>    curr <strong>=</strong> root</pre><pre>    <em># search key in the BST and set its parent pointer</em><br>    <strong>while</strong> curr <strong>and</strong> curr<strong>.</strong>data <strong>!=</strong> key:</pre><pre>        <em># update the parent to the current node</em><br>        parent <strong>=</strong> curr</pre><pre>        <em># if the given key is less than the current node, go to the left subtree;</em><br>        <em># otherwise, go to the right subtree</em><br>        <strong>if</strong> key <strong>&lt;</strong> curr<strong>.</strong>data:<br>            curr <strong>=</strong> curr<strong>.</strong>left<br>        <strong>else</strong>:<br>            curr <strong>=</strong> curr<strong>.</strong>right</pre><pre>    <em># return if the key is not found in the tree</em><br>    <strong>if</strong> curr <strong>is</strong> <strong>None</strong>:<br>        <strong>return</strong> root</pre><pre>    <em># Case 1: node to be deleted has no children, i.e., it is a leaf node</em><br>    <strong>if</strong> curr<strong>.</strong>left <strong>is</strong> <strong>None</strong> <strong>and</strong> curr<strong>.</strong>right <strong>is</strong> <strong>None</strong>:</pre><pre>        <em># if the node to be deleted is not a root node, then set its</em><br>        <em># parent left/right child to None</em><br>        <strong>if</strong> curr <strong>!=</strong> root:<br>            <strong>if</strong> parent<strong>.</strong>left <strong>==</strong> curr:<br>                parent<strong>.</strong>left <strong>=</strong> <strong>None</strong><br>            <strong>else</strong>:<br>                parent<strong>.</strong>right <strong>=</strong> <strong>None</strong></pre><pre>        <em># if the tree has only a root node, set it to None</em><br>        <strong>else</strong>:<br>            root <strong>=</strong> <strong>None</strong></pre><pre>    <em># Case 2: node to be deleted has two children</em><br>    <strong>elif</strong> curr<strong>.</strong>left <strong>and</strong> curr<strong>.</strong>right:</pre><pre>        <em># find its inorder successor node</em><br>        successor <strong>=</strong> getMinimumKey(curr<strong>.</strong>right)</pre><pre>        <em># store successor value</em><br>        val <strong>=</strong> successor<strong>.</strong>data</pre><pre>        <em># recursively delete the successor. Note that the successor</em><br>        <em># will have at most one child (right child)</em><br>        deleteNode(root, successor<strong>.</strong>data)</pre><pre>        <em># copy value of the successor to the current node</em><br>        curr<strong>.</strong>data <strong>=</strong> val</pre><pre>    <em># Case 3: node to be deleted has only one child</em><br>    <strong>else</strong>:</pre><pre>        <em># choose a child node</em><br>        <strong>if</strong> curr<strong>.</strong>left:<br>            child <strong>=</strong> curr<strong>.</strong>left<br>        <strong>else</strong>:<br>            child <strong>=</strong> curr<strong>.</strong>right</pre><pre>        <em># if the node to be deleted is not a root node, set its parent</em><br>        <em># to its child</em><br>        <strong>if</strong> curr <strong>!=</strong> root:<br>            <strong>if</strong> curr <strong>==</strong> parent<strong>.</strong>left:<br>                parent<strong>.</strong>left <strong>=</strong> child<br>            <strong>else</strong>:<br>                parent<strong>.</strong>right <strong>=</strong> child</pre><pre>        <em># if the node to be deleted is a root node, then set the root to the child</em><br>        <strong>else</strong>:<br>            root <strong>=</strong> child</pre><pre>    <strong>return</strong> root<br></pre><pre>root <strong>=</strong> deleteNode(root, 16)<br>inorder(root)</pre><pre>11 14 15 18 19 21 23 25 27 28 30 32</pre><p>Complete code: <a href="https://github.com/praharshbhatt/ds_algo_leetcode/blob/master/notes/data_structures/binary_search_tree/binary_search_tree.ipynb">https://github.com/praharshbhatt/ds_algo_leetcode/blob/master/notes/data_structures/binary_search_tree/binary_search_tree.ipynb</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1fd42976e77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter top tips and tricks you would want to bookmark]]></title>
            <link>https://medium.com/multiverse-software/flutter-top-tips-and-tricks-you-would-want-to-bookmark-1b9154a821b2?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b9154a821b2</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Mon, 18 Oct 2021 10:38:32 GMT</pubDate>
            <atom:updated>2021-10-18T10:38:32.075Z</atom:updated>
            <content:encoded><![CDATA[<h3>Custom Clippers in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/custom-clippers-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LTXiyz4DJqjrpf-i.jpg" /></figure><h3>Check if Website is Up or Down in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/check-if-website-is-up-or-down-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yWcBMiN-WEF9mJR6.jpg" /></figure><h3>Section Titles on ListView in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/section-titles-on-listview-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j9PngGplsJmalz4H.jpg" /></figure><h3>Circular Progress in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/circular-progress-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FNpNZe73nJUlVEb5.jpg" /></figure><h3>Displaying Scroll Wheels in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/displaying-scroll-wheels-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TuDb41uscwH_9ORp.jpg" /></figure><h3>Post Messages to Slack with Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/post-messages-to-slack-with-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gMvtyhKuYXC4dsVy.jpg" /></figure><h3>Unwrap List&lt;T?&gt;? in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/unwrap-list-t%3F-%3F-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gcHlEhDXr1Eg-Cit.jpg" /></figure><h3>Avoiding UI Jitters When Switching Widgets in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/avoiding-ui-jitters-when-switching-widgets-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CSwt9A1_TAuLtP4m.jpg" /></figure><h3>Detect Redirects in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/detect-redirects-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JBZMhcVlhAwIE6Ft.jpg" /></figure><h3>Proportional Constraints in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/proportional-constraints-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GazqPXSWXqgdTRtc.jpg" /></figure><h3>Displaying Cupertino Action Sheets in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/displaying-cupertino-action-sheets-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B0LIMu_azsXO_DCx.jpg" /></figure><h3>Rotating List&lt;T&gt; in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/rotating-list-t-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4fY15p7USenLagmp.jpg" /></figure><h3>Displaying SnackBars in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/displaying-snackbars-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JGwhBmVRKgImm-HY.jpg" /></figure><h3>Custom Tab Bar Using ToggleButtons in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/custom-tab-bar-using-togglebuttons-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d06_qxxvu_326GL4.jpg" /></figure><h3>Hashable Mixins in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/hashable-mixins-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XfMSsZocIbNN-FtW.jpg" /></figure><h3>Flutter Tips and Tricks in Terminal</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/flutter-tips-and-tricks-in-terminal.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WguU9ZBXidCxJVFL.jpg" /></figure><h3>Searching List&lt;List&lt;T&gt;&gt; in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/searching-listlistt-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K_TZs2hAsxb3bpBm.jpg" /></figure><h3>Cloning Objects in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/cloning-objects-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ECppQj52REQsL8ct.jpg" /></figure><h3>Color Filters in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/color-filters-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4GqgEx89bGKjU1HW.jpg" /></figure><h3>Flattening Lists in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/flattening-lists-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KdbA7H5QS6cD-nFS.jpg" /></figure><h3>Managing Duplicates in List&lt;T&gt; in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/managing-duplicates-in-list-t-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ys2QFS-pYctGVbgA.jpg" /></figure><h3>FlatMap and CompactMap in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/flatmap-and-compactmap-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nXvFZPq7tj6jA501.jpg" /></figure><h3>Equality of List&lt;T&gt; in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/equality-of-list-t-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2wxFXye3TSlr2CpM.jpg" /></figure><h3>Constants in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/constants-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SbirwbL2fELjweQp.jpg" /></figure><h3>Displaying Scrollable Bottom Sheets in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/draggable-scrollable-sheet-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ct8kbsOoiFl5oAf3.jpg" /></figure><h3>YouTube Ad Remover in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/youtube-ad-remover-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x-tq750_8j-E6aA4.jpg" /></figure><h3>Fade Between Widgets in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/fade-between-widgets-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i3ba413loxRKJUdP.jpg" /></figure><h3>Sort Descriptors in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/sort-descriptors-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PvL5IbTdd1Tkcg9b.jpg" /></figure><h3>User Sortable Columns and Tables in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/user-sortable-columns-and-tables-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Aj8Rwl8zHAfsTJfv.jpg" /></figure><h3>Content-Length of List&lt;Uri&gt; in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/content-length-of-list-of-uri-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I_EjLYOKSivkk8HR.jpg" /></figure><h3>Recursive Dot Notation on Maps in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/recursive-dot-notation-on-maps-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1ocwDYcTuabm9XUo.jpg" /></figure><h3>Allow User Selection of Text in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/allow-user-selection-of-text-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dZpPY8WGD2pbiXCT.jpg" /></figure><h3>Placing Constraints on Widgets in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/placing-constraints-on-widgets-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OGq9oDinl7YYGokQ.jpg" /></figure><h3>Animating Position Changes in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/animating-position-changes-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CobCYTmfaWzcNGus.jpg" /></figure><h3>Transitioning Between Widgets in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/transitioning-between-widgets-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*upU6AIAhXvrgUUtJ.jpg" /></figure><h3>Doubly Linked Lists in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/doubly-linked-lists-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TzCVplIyHUcuUCms.jpg" /></figure><h3>Reordering Items Inside List Views in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/reordering-items-inside-list-views-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S5jT4Aeh_y6DP0ME.jpg" /></figure><h3>Custom Stream Transformers in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/custom-stream-transformers-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rpxKpiCgmChWqqds.jpg" /></figure><h3>Expanding Stream Elements in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/expanding-stream-elements-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3XOcnhPSQ05SeU-s.jpg" /></figure><h3>Consume Streams for a Duration in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/consume-streams-for-a-duration-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dM1JhabKGG9OV-5M.jpg" /></figure><h3>Shortening URLs in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/shortening-urls-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v2INVEtrc3PWSlAh.jpg" /></figure><h3>LimitedBox Widget as ListView Items in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/limitedbox-widget-as-listview-items-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8kJGiOsggyl1lxy0.jpg" /></figure><h3>Generically Convert Anything to Int in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/generically-convert-anything-to-int-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2lTzZIVp0vRR9tO_.jpg" /></figure><h3>Validating URL Certificates in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/validating-url-certificates-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*39Sm2GOwsNY22cXO.jpg" /></figure><h3>Displaying Popup Menus in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/displaying-popup-menus-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oubCrxrbsIrmr28B.jpg" /></figure><h3>Implementing Drag and Drop in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/implementing-drag-and-drop-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cYs1dWptixWuHeFn.jpg" /></figure><h3>Dismissing List Items in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/dismissing-list-items-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dPl2mpH75oM_wN6Y.jpg" /></figure><h3>Animating Widgets with Ease in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/animating-widgets-with-ease-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H0YzBV8_RpLeZ-8U.jpg" /></figure><h3>Displaying Tool Tips in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/displaying-tool-tips-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EzcqxcdJv3ioC5Q1.jpg" /></figure><h3>Displaying Assorted Widgets Inside TableView in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/displaying-assorted-widgets-inside-tableview-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0xJeUbMkgSX3pyZB.jpg" /></figure><h3>Page Indicator with Page View in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/page-indicator-with-page-view-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y5V89DzSAkNJyWWH.jpg" /></figure><h3>Animating and Moving a Floating Action Button in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/animating-and-moving-a-floating-action-button-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uMlt-B2_Xm4WnTow.jpg" /></figure><h3>Fading Network Image Widget in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/fading-network-image-widget-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7twGXXeWyqiF9r-z.jpg" /></figure><h3>Transparent Alert Dialogs in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/transparent-alert-dialogs-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sARxHXzm86V32R1A.jpg" /></figure><h3>Network Image Size in Dart</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/network-image-size-in-dart.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4iiLoZi1ekjlNYrf.jpg" /></figure><h3>Animated Icons in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/animated-icons-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VCqqdW9WEopoi2cR.jpg" /></figure><h3>Custom Scroll Views in Flutter</h3><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks/blob/master/source/custom-scroll-views-in-flutter.dart">Source Code</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XUdlm8FRkqnw7XsV.jpg" /></figure><h3>Parallax App Bar in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tXrWZ-vHH_LrAPHc.jpg" /></figure><h3>JSON HTTP Requests in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1ccZO0-hOuvc2ETs.jpg" /></figure><h3>URL Timeouts in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fb6f3PfTfZYERwCV.jpg" /></figure><h3>Detecting URL File Types in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*akexmrbAmGTZsGNU.jpg" /></figure><h3>Paginated Lists in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h6SlHpgReRfxdqB0.jpg" /></figure><h3>Requesting DELETE on APIs in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pi5_iHhoS1kUW11K.jpg" /></figure><h3>Animated Containers in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YJUvtbLVQNpHgJUD.jpg" /></figure><h3>Hiding Widgets in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aM1iOsJ3VGL0gVIe.jpg" /></figure><h3>Simple Opacity Animation in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7smH0CnO-M3PmSW9.jpg" /></figure><h3>Vignette Widget in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xdgAIFVZZ4CFunjk.jpg" /></figure><h3>Drop Down Button Configuration and Usage in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*la-Hrcd3ThR4m1Ee.jpg" /></figure><h3>Expandable List Items in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SW1Q_wEHu5t53wJa.jpg" /></figure><h3>Infinite Scrolling in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bUSb9yK950Z_q9lQ.jpg" /></figure><h3>Infinite Arrays in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LVFvRUT7jmMmuNu0.jpg" /></figure><h3>Custom Color Picker Component in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*80lEipv_bZ41Ib_u.jpg" /></figure><h3>Displaying and Reacting to Switches in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z5jorDOuOfFrP3HY.jpg" /></figure><h3>Displaying Bottom Bars in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QdFG_741Op8BSh_s.jpg" /></figure><h3>Displaying Buttons on AppBar in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-oMko35d1xrSN21-.jpg" /></figure><h3>Displaying Bottom Sheets in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aR2UX8qRwDZOIBYE.jpg" /></figure><h3>Converting Enums to Radio Buttons in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O5t0JASU09y1IT58.jpg" /></figure><h3>Check Existence of Websites in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FKiA-4uUiNdU_x9C.jpg" /></figure><h3>Images inside AlertDialog in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TcJpmMDcjfhInVeT.jpg" /></figure><h3>Returning Values from AlertDialog in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X8WO5eGXdx_Um4xp.jpg" /></figure><h3>Simple Grid View in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5QJYYSh03WW43jKp.jpg" /></figure><h3>Rendering Bullet Points in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aYKVnh4JW18Ip3wt.jpg" /></figure><h3>Retrying Futures in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/0*jHB_22_wUcLFa74K.jpg" /></figure><h3>Containers as ClipOvals in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ASrBkHSi0BRjSGKe.jpg" /></figure><h3>Rich Texts in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IhiuAegoTDF5fk6m.jpg" /></figure><h3>Wrapping Widgets in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UQpXTy0dC9q98mtH.jpg" /></figure><h3>Sweep Gradients in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hmsUJ_PqUCgXvy3Z.jpg" /></figure><h3>Stream and StreamBuilder in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_iCTLDCvZSDs-Zuf.jpg" /></figure><h3>Blur Effect in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ij2ivVsmtOC-u4ER.jpg" /></figure><h3>Convert Enums to Strings in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dpEr62zLz4EmvWoW.jpg" /></figure><h3>Replacing Text in TextField in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AR-0RjRBNbLz5LMx.jpg" /></figure><h3>Aspect Ratio in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CZLTkT_sR0UYComD.jpg" /></figure><h3>Zoom and Pan in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TkFKMr3EjSifzrOz.jpg" /></figure><h3>Resizing Images in Flutter to Fit Screen Height</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_s3FrQzzH1KOpP4x.jpg" /></figure><h3>Validating URLs in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SWfpO8YLidCmguDX.jpg" /></figure><h3>FrameBuilder for Network Images in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6uzeHkUWkrc6AMOB.jpg" /></figure><h3>Adding Shadow to Icons in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nKcdBjelnclsl9ns.jpg" /></figure><h3>Calculating Median of Lists in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vUjfV_lqKdt2M3IN.jpg" /></figure><h3>Generic Functions with Reduce in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XGtu5V01SUEuo_Ej.jpg" /></figure><h3>Passing Back Data From a Screen to the Previous One in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hljpErSYVZHUjJLg.jpg" /></figure><h3>Flinging an Animation in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BfjZTI84vcu5q4f8.jpg" /></figure><h3>Fade Animations in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oEjo1A_gNGBOE8cM.jpg" /></figure><h3>Throttling User Input in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cFVbWi8JZhDBxOM7.jpg" /></figure><h3>Censoring TextFields in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PUwhakCE--qMXBwr.jpg" /></figure><h3>Customizing TextButton in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XEfFVUxaG20il1RA.jpg" /></figure><h3>Multiline TextFields in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gJHkAkOawpBiFXW7.jpg" /></figure><h3>Filtering TextField Input in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-itwzMEjmenEZYI8.jpg" /></figure><h3>Focusing Manually on TextFields in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jReCpy11g6_anNXG.jpg" /></figure><h3>Data Streams Over HTTP/HTTPs in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wd7tJ0rUPxkQNqvv.jpg" /></figure><h3>Catching Nonexistent Accessors or Methods in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z6kpom5S5q5RlNzX.jpg" /></figure><h3>Using Expando in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6hGoCUj_8cP-fou2.jpg" /></figure><h3>Implementing Custom Maps in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*phkbzPbBV2IWWT0A.jpg" /></figure><h3>Dynamically Calling Functions in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LEU2-x-WY3Aq-xM2.jpg" /></figure><h3>Factory Constructors in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MV5WA3nSjxTVAC3M.jpg" /></figure><h3>Calculating the Sum of List Items in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PObbD4Ki7ez16ChC.jpg" /></figure><h3>Removing Duplicate Strings in Lists in Dart (Case-Insensitive)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0WBHkqFkt5otK8NN.jpg" /></figure><h3>Implementing Range in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*02KkihSW46YHhCsc.jpg" /></figure><h3>Converting Lists to Maps in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qdVTBKGl52cYK9rv.jpg" /></figure><h3>Implementing Hashable in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YgHxFOa9Ox6t0U6r.jpg" /></figure><h3>Random Name Generator in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SvXXz7up85iiD2aF.jpg" /></figure><h3>Capturing Stack Traces in Dart Exceptions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QJ91eAb9y3Bwon0p.jpg" /></figure><h3>Removing Duplicates from Lists in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xZKqo5D514HcomF-.jpg" /></figure><h3>Optional Spread Operator in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HjoBEVifCnScuihm.jpg" /></figure><h3>Calling Optional Functions in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K0qpUpke1GXwZ9-z.jpg" /></figure><h3>Odd-Even Sort in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*40FCdbw0MUOEdT6_.jpg" /></figure><h3>Implementing Zip and Tuples in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0cZ5hALYuxdn0ra2.jpg" /></figure><h3>Swapping Values in Lists with XOR in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*drrAou-To91X0t9D.jpg" /></figure><h3>Waiting for Multiple Futures in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uTWuIBhptR4PqJdr.jpg" /></figure><h3>Using Queues as Stacks in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FQNTVmYsONWISVav.jpg" /></figure><h3>Custom Iterators in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*38te8BImBIFaFksz.jpg" /></figure><h3>Iterables as Ranges and Transform in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z6NLDg2-jzfkNHEu.jpg" /></figure><h3>Errors vs Exceptions in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ylAko2xcJzxYDZtM.jpg" /></figure><h3>Custom Annotations in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*52Wj6ZxLxG4uWtOz.jpg" /></figure><h3>Classes as Enums in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C5BEpAkDVItrx13i.jpg" /></figure><h3>Spread Operator in Collection Literals in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MwSip25bScroduUU.jpg" /></figure><h3>StreamBuilder and StreamController in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hf5rSM0k-GngJoqw.jpg" /></figure><h3>Almost Equal in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j1--QAI84A6XIOe0.jpg" /></figure><h3>Enum Associated Values in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*58kle1CSrOtBCFt1.jpg" /></figure><h3>Implementing Comparable in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZaR5jn8NdHfZxz1R.jpg" /></figure><h3>Implementing Custom Integer Types in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cTk9p2dn_yl8W-Qh.jpg" /></figure><h3>Custom Subscripts in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XfKDNR6gyNGURQO0.jpg" /></figure><h3>Dart List Enumeration with Index</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jxO9pb9Sp-MDzDXO.jpg" /></figure><h3>Applying Mixins to Other Mixins in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q6T3dzHvoKStQYOH.jpg" /></figure><h3>Parameter Types in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mjx2y0D5_y-Rjxo7.jpg" /></figure><h3>Custom Exceptions in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vWY6MsrXp7IPK4S6.jpg" /></figure><h3>rethrowing Exceptions in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Moyelr28EZxltFaw.jpg" /></figure><h3>mixins and JSON Parsing in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NX6axIs58j6-2CtV.jpg" /></figure><h3>mixins vs abstract classes in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zWmj3ileBH29g4qM.jpeg" /></figure><h3>Drawing Shapes in Flutter with LayoutBuilder, CustomPaint and CustomPainter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UWmsXiKTduGRswGC.jpeg" /></figure><h3>Generic Type Aliases in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yytdTskUY2KWt9bA.jpeg" /></figure><h3>Callable Classes in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cGJ5fvPQYw44qBm5.jpeg" /></figure><h3>Synchronous Generators in Dart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*51zdLwhLdRWJvJsk.jpeg" /></figure><h3>Implicit Interfaces in Dart</h3><p>Did you know that in #Dart, every #class implicitly exports an #interface that can be #implemented (as opposed to #extended) by other classes? This is called “implicit interface”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gYPJW7WDxbZOEk1Q.jpeg" /></figure><h3>Do you know how “const” constructors work in #Dart?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*APCvCxkmMwlyeOtf.jpeg" /></figure><h3>Did you know that in #Dart, it is actually preferred to use #async and #await over using raw #Futures?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*guHwBS-1GAo67xfc.jpeg" /></figure><h3>In #Dart, you can use a combination of #Initializer #List plus default values for your class #member #fields to create elegant and handy convenience initializers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MxctnLHuKEuGDgN6.jpeg" /></figure><h3>Did you know that in #Dart, you can extract elements of a certain type from your Lists using the #whereType #generic #function instead of calculating the #equality yourselves?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hdPW0LC0wSgl7g-g.jpeg" /></figure><h3>Do you know about #Type #Promotion in Dart?</h3><p>“address” is an optional field of the “Person” class. If you look at the “doThis()” function you see that I’m saving the value of address in a local variable and then comparing it with null and then returning if it’s null. The Dart compiler is intelligent enough to understand that after the if-statement, “address” is NOT null anymore since you’ve already compared it with null and returned from the function.</p><p>If you look at the “insteadOfThis” function, the first one, the Dart compiler cannot make the same assumption if you don’t first store the value of address in a local variable. In that first function the Dart compiler, even after the if-statement, needs you to refer to address as an optional, using “address?” syntax.</p><p>The mechanism the Dart compiler uses in the “doThis()” function is called Type Promotion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mcAUID3DVUqcqbOo.jpeg" /></figure><h3>4 lines of #Dart code that include the #spread operator, #cascade #operator, #generics, #extensions, #private prefix and #getters</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4Nrx17lLvYDa9zkZ.jpeg" /></figure><p>full course code:</p><p><a href="https://github.com/praharshbhatt/flutter-tips-and-tricks">GitHub - praharshbhatt/flutter-tips-and-tricks: Flutter tips and tricks to make the development smoother and easier</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zayc7QjmEyvBuVS-.gif" /><figcaption>Multiverse Software</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b9154a821b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multiverse-software/flutter-top-tips-and-tricks-you-would-want-to-bookmark-1b9154a821b2">Flutter top tips and tricks you would want to bookmark</a> was originally published in <a href="https://medium.com/multiverse-software">Multiverse Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TEN BENEFITS OF FLUTTER]]></title>
            <link>https://medium.com/multiverse-software/ten-benefits-of-flutter-d42362a65719?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d42362a65719</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Sat, 07 Nov 2020 01:57:30 GMT</pubDate>
            <atom:updated>2023-08-21T22:02:08.922Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dciejNCGUH4dvUcRlYgmgQ.png" /><figcaption>TEN BENEFITS OF FLUTTER</figcaption></figure><p><strong>Flutter</strong> has been a buzzword in the mobile application world for a couple of years. Well, it has lived up to the hype. The software development kit is used to build artistic User Interfaces(UI). The critical feature of Flutter is to present the pixels of UI in all platforms — mobile, web and desktop. Yep, there are no limits. Developers around the world have chosen Flutter to complete their vision. Application with a broad user base like Google Ads, Google Pay, Alibaba Group’s Xianyu, Nubank, eBay Motors</p><p>has already shifted their codebase to Flutter. There must be benefits to work on Flutter. Let’s find some of them:-</p><blockquote><a href="https://multiverseapp.com/services/mobile-application-development/">Native app development</a>(cross-platform)</blockquote><blockquote>Multiple widgets</blockquote><blockquote>Compatible with various code editors</blockquote><blockquote>Flutter community</blockquote><blockquote>Live reload and restart</blockquote><blockquote>The richness of dart and bundle of packages</blockquote><blockquote>Documentation</blockquote><blockquote>Performance</blockquote><blockquote>Open-source</blockquote><blockquote>Beautiful UI and easy to implement UX</blockquote><ol><li><strong>Native App Development</strong></li></ol><p>Flutter codebase is useful for both Android and iOs. Flutter has shown that the focus is more on the application than the platform it is based. Moreover, you can make different changes to Android and ios without affecting the other. The rendering engine never fails to support in making the application run smoothly on both platforms. Flutter Web and Desktop have been significant upgrades given by the Flutter team.</p><p><strong>2. Multiple Widgets</strong></p><p>The code idea to build an application with Flutter is to make multiple widgets that combine into the stellar User Interface(UI) that the user wants. The Flutter team came up with first the widget named Material Design. The components in Material Design are brought together to create a User Interface(UI). Developers can make their widgets too.</p><p><strong>3. Hot Reload and Restart</strong></p><p>The process of making an application must go on at a certain speed. Although, developers have been hectic in developing mobile applications because of the time consumed in converting the code to real-time application. Flutter has eased down significant tension among developers by bringing hot reload and hot restart. Hot reload speeds up the process and displays errors in no time which affects the User Interface(UI). Even if it’s a full app reload, it gets done in no time.</p><p><strong>4. Documentation</strong></p><p>Documentation has always been the first mentor to a developer who is trying to learn any new language or skill. Flutter has clear and detailed documentation that helps developers in their journey of making applications. Flutter has divided its documentation into several parts. Such as different types of widgets, backend, testing. Moreover, to make learning more fun, they have included cookbooks and a special show dedicated to Flutter. The boring flutter development show is quite popular among developers.</p><p><strong>5. Open source</strong></p><p>Open source has been a significant driving part in the advancement of our tech world. Flutter has been an open-source project since it’s release. Google always welcomes the changes requested by the flutter community. The repository of Flutter in github.com has a section called Projects; in this section, they list out all the updates and issues they are working on. Flutter 1.22 is the latest version.</p><p><strong>6. Dart</strong></p><p>Dart, which is also made by Google, is a language specially built for the optimization and customization of User Interface(UI). Dart is quite familiar to learn and use because it is based on OOP(Object Oriented Programming) concepts. Dart is well suited with the frontend and backend of the code; it has shown significant contributions in the making of Flutter web integrated with Javascript.</p><p><strong>7. Performance</strong></p><p>Tremendous results due to extreme performance. The factors which give such kinds of performances can be seen with the naked eye — first, dart, which easily converts to the native code. Moreover, Flutter has its own widgets which can be on different platforms in no time.</p><p><strong>8. User Interface</strong></p><p>Flutter serves its main motive very well, Yes, to make colorful and efficient User Interfaces(UI). From its small button to the texture of the design, the framework has covered all the minute but essential parts which help us in the creative process of making an application.</p><p><strong>9. Flutter Community</strong></p><p>A vast and friendly flutter community serves to help every <a href="https://multiverseapp.com/services/flutter-application-development/">flutter developer</a> in their endeavor. Several meetups and discussion forums help the community to grow.</p><p><strong>10. Compatible with various code editors</strong></p><p>It is compatible with various editors such as Android Studio, IntelliJ, and VSCode. Flutter is very easy to set up in any of the editors. It does give us the option to use it with a terminal or via shortcuts.</p><blockquote>Written by <a href="https://medium.com/u/d8a730bb1faa">Rajan Panchal</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sF9oK31vNJXCMAWS.gif" /><figcaption><a href="https://multiverseapp.com/">https://multiverseapp.com/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d42362a65719" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multiverse-software/ten-benefits-of-flutter-d42362a65719">TEN BENEFITS OF FLUTTER</a> was originally published in <a href="https://medium.com/multiverse-software">Multiverse Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter vs Kotlin: Who Will Be The Guardian of The Cross-Platform App Development?]]></title>
            <link>https://medium.com/multiverse-software/flutter-vs-kotlin-who-will-be-the-guardian-of-the-cross-platform-app-development-6c174de63cac?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c174de63cac</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[kotlin-native]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 14:14:13 GMT</pubDate>
            <atom:updated>2023-08-21T22:00:14.978Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*cUTqPWYJPhALnUfdhGE4eg.png" /><figcaption>Flutter Vs Kotlin</figcaption></figure><p>Actually, it is quite weird to compare Flutter and Kotlin, because one is a framework while the other is a programming language.</p><p><strong>Flutter</strong> is a framework originally released to <a href="https://multiverseapp.com/services/mobile-application-development/">build applications for Android</a>, iOS, and the <a href="https://multiverseapp.com/services/web-application-development/">Web</a> from a single codebase. It later announced that the Flutter framework can be used to build applications for Desktop too. The main selling points of the Flutter framework are rich and colorful User Interfaces(UI) with strong native performances in any of its supporting devices. There are more benefits to using a flutter framework. Let’s state some of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T8Cms1P-w9NlpWUcXxLRrA.png" /><figcaption>Flutter- cross-platform</figcaption></figure><p>1. Flutter has features such as hot-reload and hot-restart pre-installed in it. The hot-reload feature displays the changes done in a codebase and makes changes to the software accordingly. It works within seconds which makes it very fast. The hot-restart feature restarts the whole application in seconds.</p><p>2. <a href="https://multiverseapp.com/services/flutter-application-development/">Flutter</a> is made up of widgets. Flutter Widgets are really the building blocks of an application. Even a flat button is a widget in the Flutter framework which makes code more readable. Developers can move widgets as per their requirements. This makes the process less cumbersome and fast.</p><p><strong>Kotlin</strong>, a programming language that is multi-paradigm and object-oriented in its manner. It was designed by Jetbrains. It is a cross-platform tool that helps to build software in Android, iOS, Windows, and several other platforms. According to statista.com, Kotlin is in the list of “Most used programming languages among developers in 2020”. Kotlin is JVM-centric but it also compiles to Javascript in the making of Web apps. Previously, Android applications were made with the help of Java. Kotlin was introduced to replace Java to make Android Applications. Well, most people think that it did better than Java.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*jeQt0Xwl5WrPPgGFFdvnDQ.png" /><figcaption>Kotlin- App development</figcaption></figure><p>There are many questions raised regarding Kolin and what difference it has with Java. Well, there are some differences. But let’s state some reasons why Kotlin would be a good option to make applications.</p><p>1. Kotlin helps us to make better User Interfaces(UI).</p><p>2. More than two-thirds of developers say that Kotlin has helped them make them more productive while writing code for their software.</p><p>3. With the introduction of Null Pointer Exception and various other ways for safer programming in Kotlin, it has made Android applications crash less than before. Meanwhile, it is easy to debug applications in Kotlin.</p><p>4. Kotlin provides us to work on a single module and then one can move along to other modules if everything works to their wishes.</p><p>We have listed various benefits which give us a basic idea about them. To assess more, why don’t we compare them with various factors?</p><p>The factors are:-</p><p>The Backend Support</p><p>Time-oriented approach</p><p>Performance</p><p><a href="https://multiverseapp.com/services/ui-ux-design/">UI</a>/UX</p><p>Community</p><p>Programming Language Support</p><ol><li><strong>Performance</strong></li></ol><p>As mentioned, the Flutter framework has a hot-reload function which plays a major role in providing favorable conditions for a developer while writing code. Flutter does provide us with a stellar front-end for our applications because of its abundance in selecting a widget.</p><p>Kotlin also gives us fine performance because of its sound tuning with cross-platform applications. It gives us an advantage to explicitly code in the same format for all the platforms.</p><p><strong>2. Backend</strong></p><p>For flutter, Firebase comes to the scene to provide backend support. Flutter works very well with Firebase. To make it more convenient for a developer, there are several plugins available that help to integrate Firebase in a Flutter code.</p><p>Kotlin itself is a great fit for server-side tasks, which allows us to write concise code in it. It supports coroutines which is a great boost for the clients who have high requirements for their app.</p><p><strong>3. Time-oriented</strong></p><p>If you want to make an application with MVP(Minimum Viable Product), then Flutter is your go-to response. Yes, flutter takes less time to make a prototype. It is quite cost-efficient too.</p><p>Kotlin doesn’t suit this factor. It does take a huge chunk in the budget if you’re preferring Kotlin to make your application.</p><p><strong>4. UI/UX</strong></p><p>Flutter does take a lead in this. With the help of its components and widgets, Flutter does help us to make dynamic and dazzling User Interfaces(UI). Flutter several choices to build a beautiful interface. With its abundance in Widget selection and Material Components, it does beat Kotlin to this. So, if you want to impress your clients with alluring designs in your application, Flutter is your partner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T652B1RYdt_Cem372_hcNQ.gif" /><figcaption>UI in Flutter</figcaption></figure><p><strong>5. Community</strong></p><p>According to AppBrain, 1.10% of apps in Google Play Store use Flutter in their codebase. Whereas, in the case of Kotlin, 12.59% of apps use it. Companies with a larger user base for an application choose Kotlin. Still, you can’t underestimate Flutter. Major android apps in different sectors are made in Flutter. Such as:</p><p>Google Pay</p><p>Alibaba.com</p><p>Yandex Go</p><p>Nubank</p><p>Mi Fit</p><p>Kotlin has earned its name in the tech stack of major companies. Large android apps made in Kotlin are:</p><p>Google Drive</p><p>Microsoft Office</p><p>TikTok</p><p>Google Classroom</p><p>Google</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VfGrM25OneYYJs6ZJDZjcQ.jpeg" /></figure><p><strong>Conclusion</strong></p><p>It’s quite difficult to pick out one from the choices. Both are highly reliable to make your applications. The thing is that both have their pros and cons, you need to pick according to the resources, developers, and budget you’ve got.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6g2mw2x7rgN0M1dMQQofjA.gif" /><figcaption><a href="https://multiverseapp.com/">https://multiverseapp.com/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c174de63cac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multiverse-software/flutter-vs-kotlin-who-will-be-the-guardian-of-the-cross-platform-app-development-6c174de63cac">Flutter vs Kotlin: Who Will Be The Guardian of The Cross-Platform App Development?</a> was originally published in <a href="https://medium.com/multiverse-software">Multiverse Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Play Review system is broken beyond repair]]></title>
            <link>https://praharshbhatt.medium.com/google-play-review-system-is-broken-beyond-repair-c3eb355b99d1?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3eb355b99d1</guid>
            <category><![CDATA[google-play]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[google-developer]]></category>
            <category><![CDATA[play-store]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Sat, 05 Sep 2020 11:48:45 GMT</pubDate>
            <atom:updated>2020-10-17T14:39:02.051Z</atom:updated>
            <content:encoded><![CDATA[<p>We all know how broken and frustrating Google’s review system is. Many other developers have continually expressed their concerns and exhaustion over the years, and nothing seems to get better. There are several developer stories from <a href="https://www.youtube.com/watch?v=qUGSsuWeAn0">OverPass Apps</a>, “<a href="https://medium.com/@antaresone/google-just-terminated-my-google-play-developer-account-forever-f62d6362b6ac">Google just terminated my Google Play Developer account forever</a>” by <a href="https://medium.com/u/319cba8456a6">Mattia D&#39;Alleva</a>, <a href="https://medium.com/@gaurocks35/google-suspended-apps-and-play-store-developer-account-without-sufficient-warning-time-after-8680f50c6d4c">App suspension story</a> of <a href="https://medium.com/u/2ebac65aedab">Gaurav Pangam</a>, <a href="https://medium.com/tedpark-developer/3-million-downloads-app-developer-account-has-been-terminated-f5a8f78e45ca">3 million downloads Google’s App developer </a>termination of <a href="https://medium.com/u/ecac7eac58cd">Ted Park</a>’s account, <a href="https://medium.com/u/de974cdb36ba">Tokata</a>’s <a href="https://medium.com/@tokata/how-google-play-terminated-a-developer-for-no-reason-e4d760e9f472">account termination</a> the list continues.</p><p>So it all started when I received this email from a vigilante</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8hYkdP-hnGllASxhQIAmQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*2L39_taqUSzRLlBpRDqdXQ.png" /></figure><p>So the “developer” literally stole the whole store listing from our top-grossing apps <a href="https://play.google.com/store/apps/details?id=com.multiverse.jarvis&amp;hl=en_IN">Extreme Voice Assistant</a> (1 Million+ downloads), <a href="https://play.google.com/store/apps/details?id=com.multiverse.fridayai&amp;hl=en_IN">Friday Voice Assistant</a> (500k+ downloads)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HKwQNK58t0a6q78GvP2Q0A.png" /><figcaption>Extreme Assistant Copy app</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-IXfA8j32sCrXtw0EMLS8Q.png" /><figcaption>Friday Assistant Copy app</figcaption></figure><p>And it was not just the store listing, but the apps itself are 100% the same!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t24T_7h5jkIfy_FCnZVAFg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UrFuxcKERFTag0GUEAw9hw.png" /></figure><p>After I appealed to the legal team, this is the reply I got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rbdeok6qp4cp5qjvNhH-DQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cb-2H_n_4Z0i-4ZA5OB8yw.png" /></figure><p>This was strange since both the apps were hosted perfectly:</p><p><a href="https://play.google.com/store/apps/details?id=com.namanbir.fridayai">https://play.google.com/store/apps/details?id=com.namanbir.fridayai</a><br>https://play.google.com/store/apps/details?id=com.namanbir.jarvis</p><p>Furthermore, the response time for the Legal Team was around 1 month, with the least descriptive response ever. Reply delays are understandable, especially during the Covid-19 Pandemic, but all the subsequent replies were met by bot responses.</p><p>The most frustrating part is, the clone apps have better ratings and reviews!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/1*G3UkMOrU46OA7JPwA61-BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*WXv37nbM8M4FQUxvnFsf4A.png" /></figure><h3>Conclusion</h3><p>This rant was not about a clone app, but one of many examples of how the Google app review system is broken- from clone apps to unintended app suspensions, unsatisfactory responses, and bot replies from Google.</p><p>The scariest part for any developer would be waking up on a Saturday morning to come across the dreaded unexpected email of App suspension or Developer account suspension, because we all know, reinstating any app is a huge pain.</p><h3>What I wish would change</h3><p>I’d like the review system to be more transparent and descriptive, not just an email with the most generalized policy template. This will help the developers know what exactly caused the app suspension.</p><p>The other and more important thing is the response to appeals. I understand there may be thousands of appeals every hour, but bot replies help no one. Even with my limited experience with Apple’s app store, I have known Apple’s review system to be more descriptive, detailed, and reviewed by humans. This helps clear out all the questions and makes the whole appeal/review process worthwhile. If this requires Google charging a $100/year subscription fee, I’d be more than happy to pay it.</p><p>What do you think of Google’s review system? Have you had any bad experiences? Comment down below, will like to read your story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r2k3sYdOccIVPGMG.gif" /><figcaption>multiverseapp.com</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3eb355b99d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alert Dialog and Confirmation Dialog in Flutter?]]></title>
            <link>https://medium.com/multiverse-software/alert-dialog-and-confirmation-dialog-in-flutter-8d8c160f4095?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d8c160f4095</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 03:10:33 GMT</pubDate>
            <atom:updated>2020-10-17T14:39:56.444Z</atom:updated>
            <content:encoded><![CDATA[<h3>Alert Dialog and Confirmation Dialog in Flutter</h3><h3>One Button</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*7Ax4NID4bQRHvOHY.png" /></figure><pre>showAlertDialog(BuildContext context) {</pre><pre>  // set up the button<br>  Widget okButton = FlatButton(<br>    child: Text(&quot;OK&quot;),<br>    onPressed: () { },<br>  );</pre><pre>  // set up the AlertDialog<br>  AlertDialog alert = AlertDialog(<br>    title: Text(&quot;My title&quot;),<br>    content: Text(&quot;This is my message.&quot;),<br>    actions: [<br>      okButton,<br>    ],<br>  );</pre><pre>  // show the dialog<br>  showDialog(<br>    context: context,<br>    builder: (BuildContext context) {<br>      return alert;<br>    },<br>  );<br>}</pre><h3>Two Buttons</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*6_tpOlgyCqI0SLCp.png" /></figure><pre>showAlertDialog(BuildContext context) {</pre><pre>  // set up the buttons<br>  Widget cancelButton = FlatButton(<br>    child: Text(&quot;Cancel&quot;),<br>    onPressed:  () {},<br>  );<br>  Widget continueButton = FlatButton(<br>    child: Text(&quot;Continue&quot;),<br>    onPressed:  () {},<br>  );</pre><pre>  // set up the AlertDialog<br>  AlertDialog alert = AlertDialog(<br>    title: Text(&quot;AlertDialog&quot;),<br>    content: Text(&quot;Would you like to continue learning how to use Flutter alerts?&quot;),<br>    actions: [<br>      cancelButton,<br>      continueButton,<br>    ],<br>  );</pre><pre>  // show the dialog<br>  showDialog(<br>    context: context,<br>    builder: (BuildContext context) {<br>      return alert;<br>    },<br>  );<br>}</pre><h3>Three Buttons</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*KBgd8aUltl3Usi47.png" /></figure><pre>showAlertDialog(BuildContext context) {</pre><pre>  // set up the buttons<br>  Widget remindButton = FlatButton(<br>    child: Text(&quot;Remind me later&quot;),<br>    onPressed:  () {},<br>  );<br>  Widget cancelButton = FlatButton(<br>    child: Text(&quot;Cancel&quot;),<br>    onPressed:  () {},<br>  );<br>  Widget launchButton = FlatButton(<br>    child: Text(&quot;Launch missile&quot;),<br>    onPressed:  () {},<br>  );</pre><pre>  // set up the AlertDialog<br>  AlertDialog alert = AlertDialog(<br>    title: Text(&quot;Notice&quot;),<br>    content: Text(&quot;Launching this missile will destroy the entire universe. Is this what you intended to do?&quot;),<br>    actions: [<br>      remindButton,<br>      cancelButton,<br>      launchButton,<br>    ],<br>  );</pre><pre>  // show the dialog<br>  showDialog(<br>    context: context,<br>    builder: (BuildContext context) {<br>      return alert;<br>    },<br>  );<br>}</pre><h3>Handling button presses</h3><p>The onPressed callback for the buttons in the examples above were empty, but you could add something like this:</p><pre>Widget launchButton = FlatButton(<br>  child: Text(&quot;Launch missile&quot;),<br>  onPressed:  () {<br>    Navigator.of(context).pop(); // dismiss dialog<br>    launchMissile();<br>  },<br>);</pre><p>If you make the callback null, then the button will be disabled.</p><pre>onPressed: null,</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*Z2LaeTfOUMbv5xG9.png" /></figure><h3>Supplemental code</h3><p>Here is the code for main.dart in case you weren&#39;t getting the functions above to run.</p><pre>import &#39;package:flutter/material.dart&#39;;</pre><pre>void main() =&gt; runApp(MyApp());</pre><pre>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;Flutter&#39;,<br>      home: Scaffold(<br>        appBar: AppBar(<br>          title: Text(&#39;Flutter&#39;),<br>        ),<br>        body: MyLayout()),<br>    );<br>  }<br>}</pre><pre>class MyLayout extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Padding(<br>      padding: const EdgeInsets.all(8.0),<br>      child: RaisedButton(<br>        child: Text(&#39;Show alert&#39;),<br>        onPressed: () {<br>          showAlertDialog(context);<br>        },<br>      ),<br>    );<br>  }<br>}</pre><pre>// replace this function with the examples above<br>showAlertDialog(BuildContext context) { ... }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M8-F4PAexYzZLynZ.gif" /><figcaption><a href="https://multiverseapp.com/">https://multiverseapp.com/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d8c160f4095" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multiverse-software/alert-dialog-and-confirmation-dialog-in-flutter-8d8c160f4095">Alert Dialog and Confirmation Dialog in Flutter?</a> was originally published in <a href="https://medium.com/multiverse-software">Multiverse Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Combatting COVID-19 through Contact Tracing and AI Prediction]]></title>
            <link>https://medium.com/multiverse-software/combatting-covid-19-through-contact-tracing-and-ai-prediction-b126fc895ea5?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b126fc895ea5</guid>
            <category><![CDATA[corona]]></category>
            <category><![CDATA[corona-app]]></category>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[covid19]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Sat, 20 Jun 2020 04:24:19 GMT</pubDate>
            <atom:updated>2020-06-20T04:26:49.732Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*KPjoqvI_n6hvPAL4iWx9ow.jpeg" /><figcaption>Combatting COVID-19 through Contact Tracing and AI Prediction</figcaption></figure><p>At the time of writing this article, the coronavirus cases have crossed the 600,000 marks with the death toll continuously rising on an everyday basis.</p><p>Among the uncertainties around its origin story in Wuhan, the other, more fearful fact about Coronavirus is that it is extremely difficult to identify who has caught the virus. There is little to zero surety that someone has Corona until at least 14 to 20 days. And by this time, the carrier would have spread it to several other people, who in turn would spread it to hundreds other.</p><p>The only solution according to the millions of research papers that have been published since December 2019 is to break the chain. Now, although many governments are looking at measures like lockdown and social distancing, the actual effectiveness that can be drawn can by tracing contacts made by the carrier.</p><p>In this article, we are going to look into how technology, powered by Bluetooth for contact tracing, can be used to beat this pandemic. We are going to deep dive into contact tracing mobile apps for COVID-19.</p><p>But before we get to the part where we look into the technicalities of contact tracing application development and the ways to make the application let us first look into what a coronavirus tracing application is and what is the need of having one.</p><h3>What Are Coronavirus Contact Tracing Apps?</h3><p><strong>In its simplest form</strong>, the contact tracing mobile apps for COVID-19 communicates with users (people who installed the same app) via Bluetooth and stores their data locally (Device ID, other Device ID, and Timing).</p><p>When someone tests positive for COVID-19 and is marked in the system, the system allows the government to trace all the users to whom this carrier has made contact by time stamps. A record of their geographical movements are shared with the healthcare officials. Additionally, other phone owners who came close to the infected person’s phone get notification of their infection risk and are then advised to self-isolate.</p><p>This is only one of the types of contact tracing smartphone apps that the tech domain is presently looking into. The use cases are multiple and can be expanded across several other pandemics or mass-scale risks. <strong>The intent and benefits of contact tracing apps</strong>, however, in all of them is the exact same — to notify people of areas and individuals which are most likely to be affected by the virus. And in this way, play a part in breaking the chain of coronavirus spreading. This is the number one reason why organizations from across the globe are looking for a contact tracing app to slow coronavirus.</p><h3>What Does Record-Keeping Look Like</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*tfvL8l7L_yj6_R7m.jpg" /></figure><p>The image above depicts how we network. It is practically impossible to gauge whom we have come into contact with. The contact tracing mobile apps for COVID-19, simply by being in your pocket, can track the users in your proximity and notify you in case you are around someone with a high-risk profile. Additionally, it can help in backtracing the user who might be in the highest risk profile and identify if they need immediate help.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*7sWxzqGkQZ6IYpDb.jpg" /></figure><h3>How Does Contact Tracing Apps Help People Know They are COVID-19 Positive at a Time When There is Lack of Testing Kits?</h3><p>How Contact Tracing Works? The application develops a risk score for every user. One that is derived using parameters such as:</p><h4>A. Self-Assessment:</h4><p>The app for COVID-19 contact tracing generally makes use of AI to offer a quick assessment test, based on the symptoms that have been recorded by the coronavirus patients across the globe. On the basis of the test, the algorithms identify users’ risk levels.</p><h4>B. Background Assessment:</h4><p>Through the help of AI and geo-fencing, the system traces users behaviour, especially on the front of if users are:</p><ul><li>Participating in isolation or not</li><li>Maintaining social distancing</li><li>Have been quarantined in their home for 14 days</li><li>The transport mode they are using</li><li>The COVID-19 prone area they visited</li><li>Are they a frequent traveler</li><li>How many coronavirus risk-prone people they have been in contact with.</li></ul><h3>Features That Make Up For an Efficient COVID-19 Tracing App</h3><p>The feature set of well-strategized solutions like contact tracing, should majorly answer to three separate stakeholders. The stakeholders around whom the entire process of developing a digital contact tracing app revolves.</p><h3>Users side of the application</h3><h4>1. Profile</h4><p>The users must enter their personal information in the profile, which includes their basic details like name, age, etc. along with their home and work addresses.</p><h4>2. Vehicle Management</h4><p>In this section, users put in their vehicle information — the make, model, registration number, and year of purchase, etc.</p><h4>3. COVID Assessment and Self marking</h4><p>Under this part, users will be given a questionnaire assessment, where users will have to answer questions that would help recognize the risk score — one of the biggest benefits of contact tracing apps. The questions, aligning with the coronavirus symptoms is generally around body temperature, symptoms experienced, etc.</p><h4>4. Background Assessment</h4><p>The most important functionality of the contact tracing smartphone app is that they are designed to run in the background. The metrics here are mainly on the front of assessing self isolation, social distancing, mode of transport, and the average contact established.</p><ul><li>Contact tracing — the app will keep tracing the users and make a trip diary for the users. In order to achieve this, the app makes use of a bluetooth for converting the device into a beacon.</li><li>The app tracks if the users made any contact with someone who is at high coronavirus risk.</li><li>The app also tracks the users to check if they are maintaining the social distances.</li><li>Application can also track the travel history of the users and the stops they made — if the location falls under the geofence targeted by the admin, the profile will get notified, automatically.</li></ul><h4>5. Contact Tracing</h4><p>The app makes use of bluetooth for converting the device in beacons and toggle between broadcaster and receiver to start logging the contact locally. The app also takes in the bluetooth permission to toggle the device in beacon broadcaster and receiver in the threshold timing. The receiver who gets the data stores it locally along with information related to Device ID, Timing, and other Device IDs.</p><p>Ultimately, it is the beacon technology that plays an important role in the development of digital contact tracing app to combat spread of COVID-19.</p><h4>6. Trip Diary</h4><p>Since the app keeps the log of all the information, it creates a trip diary for the users to highlight the areas they have visited.</p><h4>7. Route Planner</h4><p>The users will be able to create their own route planner by entering into their start location, stops, and the end location, in addition to details like the mode of transport. The routes, eventually would help all the app users know the high prone areas — an information coming in from genuine sources.</p><h4>8. Multilingual Ability</h4><p>Localization is not just one of the most powerful marketing tools but also one that proves to be extremely helpful when it comes to making a pandemic fighting application useful.</p><h3>City admin web panel</h3><h4>1. User Management</h4><p>The city admin will have the information around users’ risk score, route planner, trip history, COVID-19 assessment, the ability to search for a user, etc.</p><h4>2. Transport Option Management</h4><p>Through the option, the city admin will be able to view all the available transport options, and manage the route management — define the route by the start and end locations, the schedules, stoppage details, closed routes, and COVID-19 prone routes.</p><h4>3. Gero-fencing Management</h4><p>The admin is able to view and create a safe area or COVID-19 prone area with the help of geo-fencing. The system also allows them to receive alerts for new areas that need immediate attention.</p><h3>Admin web panel</h3><h4>1. Dashboard</h4><p>Through the dashboard, the admin is able to view the stats around users count, city admin count, the COVID-19 prone areas, etc.</p><h4>2. Users Management</h4><p>Like the city admin, the app admin will also have the ability to view users details, the COVID-19 assessments, trip diaries, etc.</p><h4>3. City Admin Management</h4><p>The app gives them the feature to view the city admins on the platform, along with the ability to view their details.</p><h3>How Can Technology Help in Making the COVID-19 Tracing Apps More Efficient</h3><p>When we compare coronavirus to all the other pandemics that have happened before, the one clear advantage that we have, amidst the uncertainties, is the presence of disruptive technologies to make the solution more real-time, scalable, and efficient. Technologies that a <a href="https://appinventiv.com/mhealth-app-development/">sound contact tracing medical mobile app development</a> uses to deliver a real-time, scalable solution.</p><p>In the present time, we see three technologies carrying the most effect on curbing the rise of coronavirus. Here is the list of technology behind contact tracing apps.</p><h3>1. Beacon technology</h3><p>In case of contact tracing, it makes it extremely difficult to track where the users have been — the route they followed, vehicle they took, etc. The solution of this lies in the usage of a BLE Beacon technology that converts your devices into Beacon — one that gives out signals that make geo-fencing of COVID-19 prone and safe areas possible.</p><h3>2. Artificial Intelligence</h3><p>Ever since the first news of outbreak, there has been several data floating in from all across the world about Coronavirus. There are multiple ways these data points can be entered into the intelligent systems which focus on churning out insights and action items that can curb the virus from spreading. Ways that are a playground for the businesses looking to <a href="https://appinventiv.com/blog/ai-transforming-healthcare/">revolutionize healthcare with AI</a>.</p><ul><li>Detecting the next outbreak</li><li>Speed up drug discovery</li><li>Drones and Robots helping the medical staff</li><li>Chatbots sharing genuine information about the symptoms and its outbreak.</li></ul><h3>3. Blockchain</h3><p>It is impossible for any country to be fully prepared for a sudden pandemic like what coronavirus is. But with Blockchain technology at hand, businesses are finding several use cases to control the pandemic. Here’s how <a href="https://appinventiv.com/blog/hyperchain-blockchain-platform-to-fight-against-coronavirus/">Blockchain can be the answer to fighting the coronavirus pandemic</a>.</p><ul><li>Tracking the origin of donation</li><li>Making the insurance claim process transparent</li><li>Tracking of the medical material supply chain through smart contract</li><li>Low transaction, secure cross-border payments</li></ul><h3>FAQs About the Development of Contact Tracing Mobile Apps for COVID-19</h3><h4>Q. How to Develop a COVID-19 Contact Tracing Application</h4><p>The process of developing a digital contact tracing app calls for a complete understanding of the intent and working of the contact tracing smartphone app. Next, would be to know the feature set that the application comes with along with the tech stack. Let us help you with the development process.</p><h4>Q. Why Contact Tracing is Important in the Battle Against COVID-19?</h4><p>There are a number of reasons why people are using digital contact tracing app to combat the spread of COVID-19. These applications are not just designed to give users a risk score on the basis of AI-powered assessments but to notify them how prone or safe the area they are visiting is. With the help of this, the probability of the chain breaking increases by manifold.</p><p>My PortFolio<br><a href="https://praharshbhatt.github.io/">https://praharshbhatt.github.io</a></p><p>My Work<br><a href="https://multiverseapp.com/">https://multiverseapp.com</a></p><p>Linkedin<br><a href="https://www.linkedin.com/in/praharshnbhatt/">https://www.linkedin.com/in/praharshnbhatt/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b126fc895ea5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multiverse-software/combatting-covid-19-through-contact-tracing-and-ai-prediction-b126fc895ea5">Combatting COVID-19 through Contact Tracing and AI Prediction</a> was originally published in <a href="https://medium.com/multiverse-software">Multiverse Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Push Notification using Firebase Cloud Messaging (FCM)]]></title>
            <link>https://medium.com/multiverse-software/flutter-push-notification-using-firebase-cloud-messaging-fcm-396fd438d9da?source=rss-9e0a4cbe8f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/396fd438d9da</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[notifications]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[cloud-messaging]]></category>
            <dc:creator><![CDATA[Praharsh Bhatt]]></dc:creator>
            <pubDate>Sun, 09 Feb 2020 12:54:14 GMT</pubDate>
            <atom:updated>2020-02-09T12:54:14.056Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vM8jn9bqm0jAmXIEobxQ8g.png" /><figcaption>Flutter Push Notification using Firebase Cloud Messaging (FCM)</figcaption></figure><p>This tutorial, we’re going to learn <strong>how to integrate push notification in your flutter apps.</strong></p><p>For this, we’ll be using the <a href="https://pub.dev/packages/firebase_messaging">firebase_messaging plugin</a>.</p><p>Github Code: <a href="https://github.com/praharshbhatt/flutter-firebase-cloud-messaging">https://github.com/praharshbhatt/flutter-firebase-cloud-messaging</a></p><h3>Installation</h3><p>First of all, we need to create a new project or we can use the existing project. Open the pubspec.yaml and add the following dependency:</p><pre>dependencies:<br>  flutter:<br><br>    sdk: flutter<br><br>  firebase_messaging: ^6.0.9</pre><h3>Working on the Android side of things</h3><p><strong>Update Project level Gradle</strong></p><p>Navigate to your <strong>android/app/src/build.gradle</strong></p><p>Update your package name from <strong>defaultConfig </strong>to your <strong>applicationId</strong></p><p>After updating the package name, we need to add google-service inside your apply plugin: &#39;com.google.gms.google-services&#39;</p><p><strong>Update App level Gradle</strong></p><p>Open <strong>android/app/build.gradle</strong> &amp; add classpath for google-service classpath &#39;com.google.gms:google-services:4.2.0&#39;</p><p><strong>Update App manifest</strong></p><p>Open <strong>android/app/src/main/AndroidManifest.xml</strong></p><pre>&lt;intent-filter&gt;<br> &lt;action android:name=&quot;FLUTTER_NOTIFICATION_CLICK&quot;/&gt;<br> &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;<br>&lt;/intent-filter&gt;</pre><p>add the above lines inside &lt;activity&gt;</p><p><strong>google-service.json</strong></p><p>Now, download google-service.json file from firebase (mentioned in the next step) &amp; paste <strong>android/app/</strong> folder</p><h3>Working with Firebase</h3><ul><li>Login to your firebase account &amp; create a new project or choose an existing project</li><li>Navigate to <strong>Project Overview &gt; Project Settings</strong></li><li>Add your support Email then</li><li>scroll down then click <strong>Add Android App</strong></li><li>Fill your package name, nickname and SHA-1 Key (Refer: <a href="https://developers.google.com/android/guides/client-auth">https://developers.google.com/android/guides/client-auth</a>)</li><li>Click Next &amp; download <strong>google-service.json</strong></li><li>Copy google-service.json &amp; paste <strong>android/app/</strong> as mentioned on previous steps</li></ul><p>Awesome! We’ve completed the Android side of things!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*IvLZ-CZYCtbsaaMyqqVr6A.gif" /></figure><h3>Working on the iOS side of things</h3><p>To integrate your plugin into the iOS part of your app, follow these steps:</p><ol><li>Generate the certificates required by Apple for receiving push notifications following <a href="https://firebase.google.com/docs/cloud-messaging/ios/certs">this guide</a> in the Firebase docs. You can skip the section titled “Create the Provisioning Profile”.</li><li>Using the <a href="https://console.firebase.google.com/">Firebase Console</a> add an iOS app to your project: Follow the assistant, download the generated GoogleService-Info.plist file, open ios/Runner.xcworkspace with Xcode, and within Xcode place the file inside ios/Runner. <strong>Don&#39;t</strong> follow the steps named &quot;Add Firebase SDK&quot; and &quot;Add initialization code&quot; in the Firebase assistant.</li><li>In Xcode, select Runner in the Project Navigator. In the Capabilities Tab turn on Push Notifications and Background Modes, and enable Background fetch and Remote notifications under Background Modes.</li><li>Follow the steps in the “<a href="https://firebase.google.com/docs/cloud-messaging/ios/client#upload_your_apns_certificate">Upload your APNs certificate</a>” section of the Firebase docs.</li><li>Add the following lines to the (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method in the AppDelegate.m/AppDelegate.swift of your iOS project.</li></ol><p>Objective-C:</p><pre><strong>if</strong> (@available(iOS 10.0, *)) {<br>  [UNUserNotificationCenter currentNotificationCenter].delegate = (<strong>id</strong>&lt;UNUserNotificationCenterDelegate&gt;) <strong>self</strong>;<br>}</pre><p>Swift:</p><pre><strong>if</strong> #available(iOS 10.0, *) {<br>  <strong>UNUserNotificationCenter</strong>.current().delegate = <strong>self</strong> <strong>as</strong>? <strong>UNUserNotificationCenterDelegate</strong><br>}</pre><p>Awesome! We’ve now covered iOS too!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*xE1MdBRlQ_cZ9UDPBiI0Rw.gif" /></figure><p>Let’s go ahead and cover the Flutter part now.</p><h3>Working on the Flutter side of things</h3><p>Now, we can write the code to receive a notification. Copy below code and paste it on your <strong>main.dart</strong>. I have explained code below.</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:firebase_messaging/firebase_messaging.dart&#39;;<br><br>void main() =&gt; runApp(MyApp());<br><br>class MyApp extends StatefulWidget {<br>  @override<br>  State&lt;StatefulWidget&gt; createState() {<br>    return _MyAppState();<br>  }<br>}<br><br>class _MyAppState extends State&lt;MyApp&gt; {<br>  String _message = &#39;&#39;;<br><br>  final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();<br><br>  _register() {<br>    _firebaseMessaging.getToken().then((token) =&gt; print(token));<br>  }<br><br>  @override<br>  void initState() {<br>    // TODO: implement initState<br>    super.initState();<br>    getMessage();<br>  }<br>  <br>  void getMessage(){<br>    _firebaseMessaging.configure(<br>        onMessage: (Map&lt;String, dynamic&gt; message) async {<br>      print(&#39;on message $message&#39;);<br>      setState(() =&gt; _message = message[&quot;notification&quot;][&quot;title&quot;]);<br>    }, onResume: (Map&lt;String, dynamic&gt; message) async {<br>      print(&#39;on resume $message&#39;);<br>      setState(() =&gt; _message = message[&quot;notification&quot;][&quot;title&quot;]);<br>    }, onLaunch: (Map&lt;String, dynamic&gt; message) async {<br>      print(&#39;on launch $message&#39;);<br>      setState(() =&gt; _message = message[&quot;notification&quot;][&quot;title&quot;]);<br>    });<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    // TODO: implement build<br>    return MaterialApp(<br>      home: Scaffold(<br>        body: Center(<br>          child: Column(<br>            mainAxisAlignment: MainAxisAlignment.center,<br>            children: &lt;Widget&gt;[<br>              Text(&quot;Message: $_message&quot;),<br>            OutlineButton(<br>              child: Text(&quot;Register My Device&quot;),<br>              onPressed: () {<br>                _register();<br>              },<br>            ),<br>            // Text(&quot;Message: $message&quot;)<br>          ]),<br>        ),<br>      ),<br>    );<br>  }</pre><p><strong>Code Explanation</strong></p><ul><li>We created a stateful widget, because, we’re displaying messages dynamically whenever new messages arrive.</li><li>We have created an instance called _firebaseMessaging using FirebaseMessaging()</li><li>using _firebaseMessaging.getToken() we’re registering our app with firebase &amp; Received token</li><li>_firebaseMessaging.configure() allows as to create some action based on the received message, such as onMessage, onResume, onLaunch</li><li>We simply use setState to display the current message on the screen</li></ul><h3>Sending Push Notification</h3><p>If you want to send a push notification, we can use the firebase console to send a message. We also can use the terminal to testing purpose (CURL must be enabled)</p><ul><li>To get server key, please navigate to firebase <strong>Project Overview -&gt; Project Settings -&gt; Cloud Messaging</strong> &amp; copy server key</li><li>You can copy device token from your terminal</li><li>DATA=’{“notification”: {“body”: “this is a body”, “title”: “this is a title”}, “priority”: “high”, “data”: {“click<em>action”: “FLUTTER</em>NOTIFICATION<em>CLICK”, “id”: “1”, “status”: “done”}, “to”: “&lt;CLIENT FCM TOKEN&gt;</em>”}’ curl <a href="https://fcm.googleapis.com/fcm/send">https://fcm.googleapis.com/fcm/send</a> -H “Content-Type:application/json” -X POST -d “$DATA” -H “Authorization: key=&lt;SERVER KEY&gt;”</li></ul><p><strong>Note:</strong> Please insert your own server key and FCM Token</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*iusFolLqBZtVSG2AzzCU9A.gif" /></figure><p><strong>Source Code</strong></p><p><a href="https://github.com/praharshbhatt/flutter-firebase-cloud-messaging">praharshbhatt/flutter-firebase-cloud-messaging</a></p><p><strong>My PortFolio</strong></p><p><a href="https://praharshbhatt.github.io/Portfolio/">Praharsh Bhatt</a></p><p><strong>My Work</strong></p><p><a href="https://multiverseapp.com/">https://multiverseapp.com</a></p><p><strong>Linkedin</strong></p><p><a href="https://www.linkedin.com/in/praharshnbhatt/">Praharsh Bhatt - Founder and CEO - Multiverse Software India | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=396fd438d9da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multiverse-software/flutter-push-notification-using-firebase-cloud-messaging-fcm-396fd438d9da">Flutter Push Notification using Firebase Cloud Messaging (FCM)</a> was originally published in <a href="https://medium.com/multiverse-software">Multiverse Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>