<?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 gaurav sam on Medium]]></title>
        <description><![CDATA[Stories by gaurav sam on Medium]]></description>
        <link>https://medium.com/@gaurav.sam?source=rss-2bc020d2a9c3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*B43Uyw1XfMlkfXYj</url>
            <title>Stories by gaurav sam on Medium</title>
            <link>https://medium.com/@gaurav.sam?source=rss-2bc020d2a9c3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:07:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gaurav.sam/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[Handling of null value in Flutter]]></title>
            <link>https://medium.com/@gaurav.sam/handling-of-null-value-in-flutter-905bda501713?source=rss-2bc020d2a9c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/905bda501713</guid>
            <category><![CDATA[flutter-null-safety]]></category>
            <category><![CDATA[null-safety]]></category>
            <category><![CDATA[null]]></category>
            <category><![CDATA[null-aware-operator]]></category>
            <dc:creator><![CDATA[gaurav sam]]></dc:creator>
            <pubDate>Fri, 14 Jun 2024 10:17:37 GMT</pubDate>
            <atom:updated>2024-06-14T10:17:37.020Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, I am aware that based on the headline, most of you assume this is a simple concept for which there are numerous examples and explanations available online. However, I discovered that not everyone accurately comprehends the use and behaviour of the Null aware and Null Assertion operators, which is one of the reasons I decided to write this blog. Now let’s get into.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQJvwBSGaoc4eI%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fbugs-bunny-running-exercise-QJvwBSGaoc4eI&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExdG1ucnE5b3VrNGJ3YXF5OXhybXV1amdwYm81a2FzbGdqMmE5aW92YyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FQJvwBSGaoc4eI%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="313" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd18a7a3f11502698d5784abe077624d/href">https://medium.com/media/bd18a7a3f11502698d5784abe077624d/href</a></iframe><p>In order to handle null values more effectively and securely, null aware operators are used. The two main categories of null aware operators are as follows.</p><ol><li><strong>Null aware access (?)</strong>: Based on what I understand, we should use the Null aware access operator if there is a possibility that the object could be null.</li></ol><p><strong>Example :</strong></p><pre>String? name = student?.name; </pre><p>In this example, if ‘student’ is not null, the value of the name will be assigned the value of ‘student.name’, but if the student is null then the value of the name will be null without throwing an error.</p><p>2. <strong>Null aware assignment (??):</strong> We can use the Null aware assignment operator to display a placeholder string if we know that the object could be null.</p><p><strong>Example :</strong></p><pre>String? name = student?.name ?? ‘Rohan’;</pre><p>In this example, the value of the name will be “Rohan” if “student” is null, and the value of “student.name” otherwise;</p><p><strong>Handle the next opeator in your code carefully, otherwise:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FuNtESYuFhf7c4%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffail-crazy-boom-uNtESYuFhf7c4&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExaWxicXF1b2FtZzdmZzIyOHA3M29sZGg5NjEwcTVtOWh0ZXhoem4xMSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FuNtESYuFhf7c4%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="313" frameborder="0" scrolling="no"><a href="https://medium.com/media/e411113351d2a6c6476d00c82416969b/href">https://medium.com/media/e411113351d2a6c6476d00c82416969b/href</a></iframe><p><strong>Null Assertion operator (!):</strong> An additional operator is the Null Assertion operator, which is the ‘!’ operator. When an object’s type indicates that it might be nullable, it is used to inform the dart compiler that the object is not null.</p><pre>String? name = student!.name; </pre><p>In this example, if the ’student’ is not null then the value of the name will be the value of ‘student.name’. If the ‘student’ is null then it will result in a runtime error. So, it should only be used when you’re absolutely sure that the value won’t be null.</p><p>❤ ❤ Thanks for reading this article ❤❤</p><p>If I got something wrong? Let me know in the comments. I would love to improve.</p><p>Clap 👏 If this article helps you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=905bda501713" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Three W’s to choose between InkWell and GestureDetector in Flutter]]></title>
            <link>https://medium.com/@gaurav.sam/three-ws-to-choose-between-inkwell-and-gesturedetector-in-flutter-2e367ea4c897?source=rss-2bc020d2a9c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e367ea4c897</guid>
            <category><![CDATA[inkwell]]></category>
            <category><![CDATA[gesturedetector]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[ontap]]></category>
            <category><![CDATA[onclick]]></category>
            <dc:creator><![CDATA[gaurav sam]]></dc:creator>
            <pubDate>Thu, 07 Jul 2022 14:44:36 GMT</pubDate>
            <atom:updated>2022-07-07T14:44:36.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*cmpK0UzcGzUB0OJ26YWBFQ.png" /></figure><p>Hello there, i’m here again with another topic called InkWell and GestureDetector for Flutter beginners. Every flutter developer uses this widget the most frequently and extensively. We all know that picking the appropriate widget to handle onClick events in the app might be confusing at times. Let’s start with the three Ws: Why, When, and Which. Below, we’ll see the responses to each W.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FiH1ymslyrAntdmL8z3%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FiH1ymslyrAntdmL8z3%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FiH1ymslyrAntdmL8z3%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="243" frameborder="0" scrolling="no"><a href="https://medium.com/media/90df349c182d5027309f55adb5467159/href">https://medium.com/media/90df349c182d5027309f55adb5467159/href</a></iframe><p>Let’s start with our very first W, WHY?</p><p>Since most of the widgets in Flutter lack the onClick or onTap properties, we must wrap them around the widgets that do. InkWell and GestureDetector are the two widgets in question here. But hold on, which of these two widgets should I choose? That is the following question, and my response is that it all depends on your circumstances. When?</p><p>Let’s see our second W’s answer which is When :</p><p>Let’s learn a little more about these widgets before diving right into the answers.</p><p>InkWell : <strong>InkWell </strong>is the material widget in flutter. It responds to the<em> touch action</em> as performed by the user. Inkwell will respond when the user clicks the button. There are so many gestures like double-tap, long press, tap down, etc. Below are the so many properties of this widget. We can set the radius of the inkwell widget using <strong><em>radius </em></strong>and also border-radius using <strong><em>borderRadius. </em></strong>We can give the splash color using <strong><em>splashColor </em></strong>and can do a lot of things.</p><p>Yes, I am aware of a flawless but dull definition. So let’s interpret in our own terms. Use Inkwell if you wish to display a ripple effect or any other kind of impact on a clickable widget, such as a button that when clicked shows us that the widget has been tapped. Most often, Inkwell is not only a onClick widget.Let’s see its properties :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*Ok7j5xQn0STycCu_gVS8ZQ.png" /></figure><p>GestureDetector : <strong>GestureDetector</strong>. GestureDetector is a non-visual widget primarily used for detecting the user’s gesture. To identify a gesture targeted on a widget, the widget can be placed inside GestureDetector widget. GestureDetector will capture the gesture and dispatch multiple events based on the gesture.</p><p>To clarify, we can use this widget if we don’t want the user to see any effects when tapping on any widget (for example, when moving between screens). InkWell has several qualities that make it a great widget in addition to some straightforward ones that save developers’ time. It does not stop at merely onClick. So let’s check some of its powerful properties/events :</p><ul><li>Tap</li><li>onTapDown</li><li>onTapUp</li><li>onTap</li><li>onTapCancel</li><li>Double tap</li><li>onDoubleTap</li><li>Long press</li><li>onLongPress</li><li>Vertical drag</li><li>onVerticalDragStart</li><li>onVerticalDragUpdate</li><li>onVerticalDragEnd</li><li>Horizontal drag</li><li>onHorizontalDragStart</li><li>onHorizontalDragUpdate</li><li>onHorizontalDragEnd</li><li>Pan</li><li>onPanStart</li><li>onPanUpdate</li><li>onPanEnd</li></ul><p>And it’s not the end, Picture abhi baki hai mere dost / And that’s not all; the picture still has more to say.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*nIKlJoLXYEcNKtv1c7kG4Q.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F26ufq9mryvc5HI27m%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F26ufq9mryvc5HI27m%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F26ufq9mryvc5HI27m%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="292" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc0367cd1809dbbc9a4dcbb1b86e1763/href">https://medium.com/media/bc0367cd1809dbbc9a4dcbb1b86e1763/href</a></iframe><p>Now at this moment i think we all know the answer of our last W, right? So, for the last W, we have to check our requirement that what we want to implement and according to our requirement we have to decide which one is suitable widget to implement.</p><p>❤ ❤ Thanks for reading this article ❤❤</p><p>If I got something wrong? Let me know in the comments. I would love to improve.</p><p>Clap 👏 If this article helps you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e367ea4c897" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best way to minimize app load using Sizedbox.]]></title>
            <link>https://medium.com/@gaurav.sam/best-way-to-minimize-app-load-using-sizedbox-740cb3af5a67?source=rss-2bc020d2a9c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/740cb3af5a67</guid>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[widget]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <dc:creator><![CDATA[gaurav sam]]></dc:creator>
            <pubDate>Mon, 27 Jun 2022 15:37:57 GMT</pubDate>
            <atom:updated>2022-06-27T15:37:57.770Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*cmpK0UzcGzUB0OJ26YWBFQ.png" /></figure><p>In this tutorial, We will learn how to use Sizedbox effectively and reduce the load on the app.</p><p>As a newbie, when I first started using Flutter, I exclusively used containers everywhere, although where I simply needed to specify width and height. However, as an experienced developer, I’ve realised how foolish that was.</p><p>Since so many beginners still engage in this behaviour, what else should we use? Yes, there is a widget called Sizedbox, which is frequently used and is the appropriate approach to utilise the widget when you simply require a box with a child that is a specific height and width.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7WvAUvZZTRpSuudobh%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7WvAUvZZTRpSuudobh%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F7WvAUvZZTRpSuudobh%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fd5976714911b4179920b922a31de5f/href">https://medium.com/media/6fd5976714911b4179920b922a31de5f/href</a></iframe><p>So let’s check, why we should not use Container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*u-OPmP1fhgkqtvdBME1cDQ.png" /></figure><p>So, as we can see, Container has a lot of attributes. If all we need is a box with a certain size, then why not just use a box and give it the size we need?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FCBFgxojcXwac%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FCBFgxojcXwac%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FCBFgxojcXwac%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="300" frameborder="0" scrolling="no"><a href="https://medium.com/media/81ccb79af6d9a84bffbf19d2e62c06b8/href">https://medium.com/media/81ccb79af6d9a84bffbf19d2e62c06b8/href</a></iframe><p>Now, Let’s check why we should use Sizedbox instead of Container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/214/1*h69-MTVEXcf5eEia7IeZmw.png" /></figure><p>No further explanation is necessary, in my opinion, as everyone can see 😉.</p><p><strong>Conclusion:</strong></p><p>As we can see, container has many more features than sizedbox and is a much heavier widget, putting unnecessary strain on your widget tree. For needs when all you need is a box with a child, it is therefore preferable to use sizedbox.</p><p>❤ ❤ Thanks for reading this article ❤❤</p><p>If I got something wrong? Let me know in the comments. I would love to improve.</p><p>Clap 👏 If this article helps you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=740cb3af5a67" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>