<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shah Poran</title>
    <description>The latest articles on DEV Community by Shah Poran (@spporan).</description>
    <link>https://dev.to/spporan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F861050%2Fd303c6c7-8249-4b93-889f-c0edf2be1837.jpeg</url>
      <title>DEV Community: Shah Poran</title>
      <link>https://dev.to/spporan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/spporan"/>
    <language>en</language>
    <item>
      <title>Unlocking the Power of Sealed Classes and Interfaces in Kotlin</title>
      <dc:creator>Shah Poran</dc:creator>
      <pubDate>Thu, 04 May 2023 12:04:37 +0000</pubDate>
      <link>https://dev.to/spporan/unlocking-the-power-of-sealed-classes-and-interfaces-in-kotlin-561a</link>
      <guid>https://dev.to/spporan/unlocking-the-power-of-sealed-classes-and-interfaces-in-kotlin-561a</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YgjeY9mz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tec3wg3ab9ogqyjgjud2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YgjeY9mz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tec3wg3ab9ogqyjgjud2.png" alt="code image" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sealed classes and sealed interfaces in Kotlin are powerful features for creating class hierarchies with restricted subtypes. These features enable developers to define a limited and predefined set of subtypes, while also preventing any new subtypes from being created outside of the hierarchy.&lt;br&gt;
Sealed class&lt;/p&gt;

&lt;p&gt;sealed class is a class that can only be subclassed in its own file. This means that all subclasses of the sealed class must be defined in the same file as the sealed class itself. Sealed classes are useful for representing restricted class hierarchies, whereas a value can only have a finite set of types.&lt;/p&gt;

&lt;p&gt;Sealed classes in Kotlin are useful in a variety of scenarios where you have a limited set of possible data types, and you want to represent them in a type-safe manner. Now I will demonstrate some common and rare use cases for sealed classes.&lt;br&gt;
Representing the result of an operation: &lt;/p&gt;

&lt;p&gt;Sealed classes can be used to represent the result of an operation, where the result can either be successful or contain an error. For example, the following code defines a sealed class Result with two subclasses: Success and Error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sealed class Result
data class Success(val data: String) : Result()
data class Error(val message: String) : Result()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can make it generic also&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sealed class Result&amp;lt;out T&amp;gt;
data class Success&amp;lt;out T&amp;gt;(val data: T) : Result&amp;lt;T&amp;gt;()
data class Error(val message: String) : Result&amp;lt;Nothing&amp;gt;()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this above example, the Result class is sealed and has two subclasses: Success and Error. These subclasses can only be defined in the same file as the Result class.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Modeling state in a finite state machine:
 Sealed classes can be used to model the different states in a finite state machine. For example, the following code defines a sealed class State with two subclasses: Loading and Loaded.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sealed class State
object Loading : State()
data class Loaded(val data: String) : State()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Representing a fixed set of data types:
 Sealed classes can be used to represent a fixed set of data types, such as different types of shapes. The following code defines a sealed class Shape with three subclasses: Circle, Rectangle, and Triangle.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sealed class Shape
class Circle(val radius: Double) : Shape()
class Rectangle(val width: Double, val height: Double) : Shape()
class Triangle(val base: Double, val height: Double) : Shape()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Implementing the Visitor pattern:
Sealed classes can be used to implement the Visitor pattern, which allows you to define operations on a hierarchy of types without modifying their implementation. For example, the following code defines a sealed class Expression with two subclasses: Number and Sum. It also defines an interface Visitor with two methods: visitNumber and visitSum. Each subclass of Expression implements the accept method to call the appropriate method on the Visitor.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sealed class Expression {
    abstract fun accept(visitor: Visitor): Int
}

class Number(val value: Int) : Expression() {
    override fun accept(visitor: Visitor): Int = visitor.visitNumber(this)
}

class Sum(val left: Expression, val right: Expression) : Expression() {
    override fun accept(visitor: Visitor): Int = visitor.visitSum(this)
}

interface Visitor {
    fun visitNumber(number: Number): Int
    fun visitSum(sum: Sum): Int
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Implementing algebraic data types:
 Sealed classes can be used to implement algebraic data types, which are types composed of simpler types. The following code defines a sealed class Expr with three subclasses: Value, Add, and Multiply. The Value subclass contains a single Double value, while the Add and Multiply subclasses contain two Expr values.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sealed class Expr {
    abstract fun eval(): Double
}

data class Value(val value: Double) : Expr() {
    override fun eval(): Double = value
}

data class Add(val left: Expr, val right: Expr) : Expr() {
    override fun eval(): Double = left.eval() + right.eval()
}

data class Multiply(val left: Expr, val right: Expr) : Expr() {
    override fun eval(): Double = left.eval() * right.eval()
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can read full article from &lt;a href="https://poran-cse.medium.com/unlocking-the-power-of-sealed-classes-and-interfaces-in-kotlin-7f517732a2e8"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>android</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Creating a Floating Alert Dialog like google translate with Material Design 3 in android</title>
      <dc:creator>Shah Poran</dc:creator>
      <pubDate>Sat, 04 Jun 2022 05:19:07 +0000</pubDate>
      <link>https://dev.to/spporan/creating-a-floating-alert-dialog-like-google-translate-with-material-design-3-in-android-4o77</link>
      <guid>https://dev.to/spporan/creating-a-floating-alert-dialog-like-google-translate-with-material-design-3-in-android-4o77</guid>
      <description>&lt;p&gt;I’m going to show you how to create a Floating alert dialog like tap to translate features in the google translate app using a material design 3. The google translate app can open a floating alert dialog wherever you want to select a text. My approach is simple. At first, I will create a translucent theme that actually inheritance from Theme.Material3.DayNight.NoActionBar after that, I will set the theme for the activity which will open when a floating dialog appears on the screen. You can read the full article from here, &lt;a href="https://poran-cse.medium.com/creating-a-floating-alert-dialog-like-google-translate-with-material-design-3-in-android-4b5cbab57571"&gt;https://poran-cse.medium.com/creating-a-floating-alert-dialog-like-google-translate-with-material-design-3-in-android-4b5cbab57571&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>tutorial</category>
      <category>kotlin</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Flutter Overlay loader</title>
      <dc:creator>Shah Poran</dc:creator>
      <pubDate>Sat, 14 May 2022 08:50:17 +0000</pubDate>
      <link>https://dev.to/spporan/flutter-overlay-loader-lda</link>
      <guid>https://dev.to/spporan/flutter-overlay-loader-lda</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GC_sei69--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/badge/Build-passing-green" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GC_sei69--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/badge/Build-passing-green" alt="Build Passing" width="88" height="20"&gt;&lt;/a&gt; &lt;a href="https://pub.dev/packages/flutter_overlay_loader"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vQrXAJOF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pub/v/flutter_overlay_loader%3Flogo%3Dflutter%26logoColor%3Dblue" alt="Pub Version" width="93" height="20"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7HuTdmK---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pub/likes/flutter_overlay_loader%3Flogo%3Dflutter%26logoColor%3Dblue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7HuTdmK---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pub/likes/flutter_overlay_loader%3Flogo%3Dflutter%26logoColor%3Dblue" alt="Pub Likes" width="75" height="20"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TygNC9Ur--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pub/points/flutter_overlay_loader%3Flogo%3Dflutter%26logoColor%3Dblue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TygNC9Ur--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pub/points/flutter_overlay_loader%3Flogo%3Dflutter%26logoColor%3Dblue" alt="Pub Points" width="117" height="20"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O5du_J-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pub/popularity/flutter_overlay_loader%3Flogo%3Dflutter%26logoColor%3Dblue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O5du_J-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pub/popularity/flutter_overlay_loader%3Flogo%3Dflutter%26logoColor%3Dblue" alt="Pub Popularity" width="117" height="20"&gt;&lt;/a&gt; &lt;a href="https://github.com/spporan/FlutterOverlayLoader/network"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--snpZVjcJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/github/forks/spporan/FlutterOverlayLoader" alt="GitHub forks" width="60" height="20"&gt;&lt;/a&gt; &lt;a href="https://github.com/spporan/FlutterOverlayLoader/stargazers"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PIiPM7Dw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/github/stars/spporan/FlutterOverlayLoader" alt="GitHub stars" width="54" height="20"&gt;&lt;/a&gt; &lt;a href="https://github.com/spporan/FlutterOverlayLoader/issues"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZjMHJcDi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/github/issues/spporan/FlutterOverlayLoader" alt="GitHub issues" width="90" height="20"&gt;&lt;/a&gt; &lt;a href="https://github.com/spporan"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RgovL2nn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/github/followers/spporan%3Fstyle%3Dsocial" alt="GitHub followers" width="106" height="20"&gt;&lt;/a&gt; &lt;a href="https://twitter.com/intent/tweet?text=Wow:&amp;amp;url=https%3A%2F%2Fgithub.com%2Fspporan%2FFlutterOverlayLoader%2F"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lpS89v4T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/twitter/url%3Fstyle%3Dsocial%26url%3Dhttps%253A%252F%252Fmobile.twitter.com%252Fmdshahparan520" alt="Twitter" width="61" height="20"&gt;&lt;/a&gt; &lt;a href="https://github.com/spporan/FlutterOverlayLoader/blob/master/LICENSE"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KTKhMgLb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/github/license/spporan/FlutterOverlayLoader" alt="GitHub license" width="120" height="20"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  flutter_overlay_loader
&lt;/h1&gt;

&lt;p&gt;A simple Flutter package for managing loader when&lt;br&gt;
fetching remote data or any long running async task. Flutter overlay loader is easy to use.&lt;br&gt;
You can show loader using only write two lines of code.&lt;/p&gt;

&lt;p&gt;Overlay loader without overlaying Appbar&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z4i0qlfb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/21147796/111874514-e9405b80-89bf-11eb-9508-3ad1b66ac3ef.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z4i0qlfb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/21147796/111874514-e9405b80-89bf-11eb-9508-3ad1b66ac3ef.jpg" alt="drawing" width="720" height="1440"&gt;&lt;/a&gt;  &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_GwhTijN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/21147796/111874551-0f65fb80-89c0-11eb-851e-92c88872ac16.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_GwhTijN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/21147796/111874551-0f65fb80-89c0-11eb-851e-92c88872ac16.jpg" alt="drawing" width="720" height="1440"&gt;&lt;/a&gt; 
&lt;/p&gt;

&lt;p&gt;Overlay Loader without overlaying BottomAppBar and also overlaying AppBar&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z4i0qlfb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/21147796/111874514-e9405b80-89bf-11eb-9508-3ad1b66ac3ef.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z4i0qlfb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/21147796/111874514-e9405b80-89bf-11eb-9508-3ad1b66ac3ef.jpg" alt="drawing" width="720" height="1440"&gt;&lt;/a&gt; 
&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Installing
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;flutter_overlay_loader&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.0.8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Import
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter_overlay_loader/flutter_overlay_loader.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How To Use
&lt;/h2&gt;

&lt;p&gt;When start network call then call this line of code..&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;Loader&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;show&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;progressIndicator:&lt;/span&gt;&lt;span class="n"&gt;LinearProgressIndicator&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After finished network call then call :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;Loader&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hide&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can customize this loader..&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;Loader&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;show&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;isSafeAreaOverlay:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;isBottomBarOverlay:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;overlayFromBottom:&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;overlayColor:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;black26&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;progressIndicator:&lt;/span&gt; &lt;span class="n"&gt;CircularProgressIndicator&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;backgroundColor:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;red&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
  &lt;span class="nl"&gt;themeData:&lt;/span&gt; &lt;span class="n"&gt;Theme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;copyWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;colorScheme:&lt;/span&gt; &lt;span class="n"&gt;ColorScheme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromSwatch&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;copyWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;secondary:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;green&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also check loader is showing or not using the property :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 and you can
prevent back pressed like this snippet:



```dart
WillPopScope(
  child: //TODO , 
  onWillPop:()async =&amp;gt; !Loader.isShown
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally dispose call hide method on dispose method :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="nd"&gt;@override&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;dispose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;Loader&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hide&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dispose&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>flutter</category>
      <category>flutterdev</category>
      <category>dart</category>
    </item>
  </channel>
</rss>
