<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>null safety flutter Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/null-safety-flutter/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/null-safety-flutter/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 22 May 2021 06:37:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>[SOLVED] Flutter : NoSuchMethodError: The getter &#8216;isEmpty&#8217; was called on null.</title>
		<link>https://www.scmgalaxy.com/tutorials/flutter-nosuchmethoderror-the-getter-isempty-was-called-on-null/</link>
					<comments>https://www.scmgalaxy.com/tutorials/flutter-nosuchmethoderror-the-getter-isempty-was-called-on-null/#respond</comments>
		
		<dc:creator><![CDATA[Sushant K]]></dc:creator>
		<pubDate>Sat, 22 May 2021 06:33:36 +0000</pubDate>
				<category><![CDATA[Flutter]]></category>
		<category><![CDATA[flutter]]></category>
		<category><![CDATA[isEmpty]]></category>
		<category><![CDATA[isEmpty was called on null]]></category>
		<category><![CDATA[no sound null flutter]]></category>
		<category><![CDATA[NoSuchMethodError]]></category>
		<category><![CDATA[null safety]]></category>
		<category><![CDATA[null safety flutter]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=6339</guid>

					<description><![CDATA[<p>Problem I&#8217;m Calling An API and getting response in Variable Data ($data). When data is coming then there is no [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/flutter-nosuchmethoderror-the-getter-isempty-was-called-on-null/">[SOLVED] Flutter : NoSuchMethodError: The getter &#8216;isEmpty&#8217; was called on null.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="has-text-align-center wp-block-heading"><strong><span class="has-inline-color has-vivid-red-color">Problem</span></strong></h2>



<p class="wp-block-paragraph">I&#8217;m Calling An API and getting response in Variable Data ($data). When data is coming then there is no Error but when I&#8217;m getting null as response then getting this error <strong>Unhandled Exception: NoSuchMethodError: The getter &#8216;isEmpty&#8217; was called on null.</strong></p>



<p class="wp-block-paragraph"> When I am using the below code then it is throwing me an error:</p>



<script src="https://gist.github.com/SushantSinghRajput03/794f41a5c997965d7d51719aab6811fa.js"></script>



<h2 class="has-text-align-center wp-block-heading"><span class="has-inline-color has-vivid-red-color">Solution</span></h2>



<p class="wp-block-paragraph">That is because <strong>$data</strong> returns&nbsp;<code>null</code>, So I&#8217;ve Used </p>



<pre class="wp-block-code"><code><code><span class="has-inline-color has-vivid-red-color">if(data?.isEmpty ?? true)</span></code>
</code></pre>



<p class="wp-block-paragraph"><code>?</code>&nbsp;prevents an error if the previous part of the expression results in&nbsp;<code>null</code>&nbsp;and&nbsp;<code>?? true</code>&nbsp;results in&nbsp;<code>true</code>&nbsp;if the previous part of the expression is&nbsp;<code>null</code>&nbsp;and therefore treats&nbsp;<code>== null</code>&nbsp;and&nbsp;<code>isEmpty</code>&nbsp;the same for the&nbsp;<code>if(...)</code>&nbsp;check.</p>



<p class="wp-block-paragraph">Now My Code is working Fine.</p>



<p class="wp-block-paragraph">Thanks for reading.</p>



<p class="wp-block-paragraph">Keep Coding.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://professnow.com/blog/wp-content/uploads/2021/01/Keep_coding.gif" alt="" class="wp-image-26" width="75" height="75"/></figure>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/flutter-nosuchmethoderror-the-getter-isempty-was-called-on-null/">[SOLVED] Flutter : NoSuchMethodError: The getter &#8216;isEmpty&#8217; was called on null.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/flutter-nosuchmethoderror-the-getter-isempty-was-called-on-null/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
