<?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: Monikinderjit Singh</title>
    <description>The latest articles on DEV Community by Monikinderjit Singh (@monik).</description>
    <link>https://dev.to/monik</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%2F505645%2F1eb6a6b7-2d78-4ce8-821d-020daf16dec5.jpg</url>
      <title>DEV Community: Monikinderjit Singh</title>
      <link>https://dev.to/monik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/monik"/>
    <language>en</language>
    <item>
      <title>How to create a hover effect in Flutter in minutes?</title>
      <dc:creator>Monikinderjit Singh</dc:creator>
      <pubDate>Fri, 10 Sep 2021 18:06:38 +0000</pubDate>
      <link>https://dev.to/monik/how-to-create-a-hover-effect-in-flutter-in-minutes-1ef0</link>
      <guid>https://dev.to/monik/how-to-create-a-hover-effect-in-flutter-in-minutes-1ef0</guid>
      <description>&lt;h2&gt;
  
  
  How to create a Hover Effect in Flutter in minutes?
&lt;/h2&gt;

&lt;p&gt;Are you wondering how you can create a hovering effect in Flutter(Web) as Flutter does not provide a single widget to do that? &lt;br&gt;
The hovering effect is one of the most important features in all e-commerce websites/apps. It is generally used to ask for extra user attention and action. So it's important to know how we can do that in Flutter.&lt;/p&gt;

&lt;p&gt;So buckle up your seat belts and let's dive into it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FWp7qEwWS8sx7KR9Xql%2Fgiphy.gif%3Fcid%3Decf05e475d1jt5zex2rfy1gmfz1ms1z8da7pytosjvlxkhx8%26rid%3Dgiphy.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FWp7qEwWS8sx7KR9Xql%2Fgiphy.gif%3Fcid%3Decf05e475d1jt5zex2rfy1gmfz1ms1z8da7pytosjvlxkhx8%26rid%3Dgiphy.gif%26ct%3Dg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What's the content
&lt;/h2&gt;

&lt;p&gt;We will be using Flutter's in-built features to implement a hovering effect. So no need to add expensively (cool down, I know they are free but I'm saying in context to efficiency and code) and non-efficient (most of the packages are badly written) to have this simple effect. We will be going through:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting up the Flutter project&lt;/li&gt;
&lt;li&gt;Brief Intro to InkWell&lt;/li&gt;
&lt;li&gt;Whats' this Animated Container?&lt;/li&gt;
&lt;li&gt;Implement Hovering effect&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Setting Up Flutter Project
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Go to cmd/terminal and type &lt;code&gt;flutter create &amp;lt;project_name&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 2&lt;/strong&gt;: Type &lt;code&gt;cd &amp;lt;project_name&amp;gt;&lt;/code&gt; in terminal and run flutter pub get&lt;br&gt;
&lt;strong&gt;Step 3&lt;/strong&gt;: Now lets remove this boiler plate code and start working.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tip: You can simply press &lt;code&gt;Ctrl+F&lt;/code&gt; and enable regular expressions (&lt;code&gt;Alt+r&lt;/code&gt;). Type &lt;code&gt;//.*&lt;/code&gt; and all the commented lines will be selected. Now you can replace it with empty space and press Ctrl+F or any key binding you have set for formatting. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ok cool, we are now ready to understand our widgets to be used.&lt;/p&gt;
&lt;h3&gt;
  
  
  Brief Intro to InkWell
&lt;/h3&gt;

&lt;p&gt;InkWell is an amazing material widget in Flutter which comes with many in-built features such as splashColor, onLongPress and many more. Some of the important parameters for our purpose are listed in the table below:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Let's answer some of your questions:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ques1: So why are we using InkWell?&lt;br&gt;
The question lies in the above table. As we can see the InkWell has an onHover function which is called when the user brings in/out the mouse to the widget. &lt;/p&gt;

&lt;p&gt;Ques2: So whats' our idea?&lt;br&gt;
We will be using this amazing feature by InkWell to change the boundaries of the container which will look like a hovering effect.&lt;/p&gt;

&lt;p&gt;Ques3: Hey but the container has fixed height and width and not a good animation too when increasing size. How we will cope up with this?&lt;br&gt;
So that's our next section, Animated Containers. Let's quickly go there.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Whats' this AnimatedContainer?
&lt;/h3&gt;

&lt;p&gt;AnimatedContainer is a special Container that helps us give more wizardly powers to a simple Container. As the name suggests, it is a container with the capabilities to add animations. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Animated version of Container that gradually changes its values over a period of time.                      ---From  &lt;a href="https://api.flutter.dev/flutter/widgets/AnimatedContainer-class.html" rel="noopener noreferrer"&gt;api.flutter.dev&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's look into its arguments:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;So we now are ready with our fundamentals strong. So lets' finally code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's code &amp;amp; implement the hovering effect
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Create a stateful class HoveringWidget. Why Stateful? Because we are going to use AnimatedContainer and it's always better to use Stateful class.&lt;br&gt;
Create an InkWell widget as shown below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

class HoveringWidget extends StatefulWidget {
  _HoveringWidgetState createState() =&amp;gt; _HoveringWidgetState();
}

class _HoveringWidgetState extends State&amp;lt;HoveringWidget&amp;gt; {
  @override
  Widget build(BuildContext context) {
    return InkWell(
        child:Text("Hover Button"),
        onTap:(){},
        onHover:(val){} 
         /*val---&amp;gt;true when user brings in mouse
         val---&amp;gt; false when brings out his mouse*/
    );
  }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;onHover is this function that will be called when a user brings it to the mouse inside/outside. &lt;br&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt; Create a boolean variable isHover and set it to false.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

bool isHover=false;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Inside onHover function, use setState to change the value of isHover to val.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  setState((){
        isHover=val;
      });


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Now we are done with InkWell. So let's wrap this widget inside AnimatedContainer and add duration, padding to it. Carefully look at how I have given padding over here:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

 Widget build(BuildContext context) {
    return AnimatedContainer(
      height:100,//there should be outline/dimensions for the box. 
      //Otherway, You can use positioned widget
      duration: Duration(milliseconds: 200),
      padding: EdgeInsets.only(top: (isHover) ? 25 : 30.0, bottom:!(isHover)? 25:30),
      child: InkWell( 
        onTap:(){},
        child: Text("Hover Button"),
        onHover: (val) {
          setState(() {
            isHover = val;
          });
        },
      ),
      /*val---&amp;gt;true when user brings in mouse
     val---&amp;gt; false when brings out his mouse*/
    );
  }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;When the isHover will be true, it will decrease top padding and element will move upwards. With animations, it will look like hovering and will hence create our hovering effect.&lt;/p&gt;

&lt;p&gt;It should be working now!&lt;br&gt;
Now let's do some decoration over InkWell to look better.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: AnimatedContainer(
          height: 70,
          duration: Duration(milliseconds: 200),
          padding: EdgeInsets.only(
              top: (isHover) ? 25 : 30.0, bottom: !(isHover) ? 25 : 30),
          child: Container(
            height: 30,
            color: Colors.blue,
            child: InkWell(
              onTap: () {},
              child: Text("Hover Button"),
              onHover: (val) {
                print("Val---&amp;gt;{}$val");
                setState(() {
                  isHover = val;
                });
              },
            ),
            /*val---&amp;gt;true when user brings in mouse
           val---&amp;gt; false when brings out his mouse*/
          ),
        ),
      ),
    );


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Tip: You can add vertical padding to give a slanting hover animation effect.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Kudos 🎉🎉
&lt;/h2&gt;

&lt;p&gt;Hayyyy, you made it till the end. I hope you enjoyed working with animated Containers.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F136dgbul9Tk8Rq%2Fgiphy.gif%3Fcid%3Decf05e47o3vn3j4yy536hlwogv4e3yhaztb1bbz9655qk7z5%26rid%3Dgiphy.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F136dgbul9Tk8Rq%2Fgiphy.gif%3Fcid%3Decf05e47o3vn3j4yy536hlwogv4e3yhaztb1bbz9655qk7z5%26rid%3Dgiphy.gif%26ct%3Dg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Little Bit About Me🧑‍💻🧑‍💻🧑‍💻
&lt;/h2&gt;

&lt;p&gt;Hey developers, I'm Monikinderjit Singh, working on Flutter for more than a year now. My interest in cloud technology is fueled by my need to learn more about it.  I am currently new to hashnode (this is my second blog post). I would appreciate you giving it a like if you find it interesting and leaving a comment if you have a better solution for this topic. It would be awesome if you could give me some feedback on improving my content.&lt;br&gt;
You can connect with me on my &lt;a href="https://twitter.com/intent/follow?screen_name=monikIJS" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://github.com/Monik09" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and  &lt;a href="https://www.linkedin.com/in/monikinderjit-singh/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; .  &lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to create a Hover Effect in Flutter in minutes?</title>
      <dc:creator>Monikinderjit Singh</dc:creator>
      <pubDate>Mon, 06 Sep 2021 11:38:33 +0000</pubDate>
      <link>https://dev.to/monik/how-to-create-a-hover-effect-in-flutter-in-minutes-3jng</link>
      <guid>https://dev.to/monik/how-to-create-a-hover-effect-in-flutter-in-minutes-3jng</guid>
      <description>&lt;p&gt;Are you wondering how you can create a hovering effect in Flutter(Web) as Flutter does not provide a single widget to do that? &lt;br&gt;
The hovering effect is one of the most important features in all e-commerce websites/apps. It is generally used to ask for extra user attention and action. So it's important to know how we can do that in Flutter.&lt;/p&gt;

&lt;p&gt;So buckle up your seat belts and let's dive into it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FWp7qEwWS8sx7KR9Xql%2Fgiphy.gif%3Fcid%3Decf05e475d1jt5zex2rfy1gmfz1ms1z8da7pytosjvlxkhx8%26rid%3Dgiphy.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FWp7qEwWS8sx7KR9Xql%2Fgiphy.gif%3Fcid%3Decf05e475d1jt5zex2rfy1gmfz1ms1z8da7pytosjvlxkhx8%26rid%3Dgiphy.gif%26ct%3Dg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What's the content
&lt;/h2&gt;

&lt;p&gt;We will be using Flutter's in-built features to implement a hovering effect. So no need to add expensively (cool down, I know they are free but I'm saying in context to efficiency and code) and non-efficient (most of the packages are badly written) to have this simple effect. We will be going through:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting up the Flutter project&lt;/li&gt;
&lt;li&gt;Brief Intro to InkWell&lt;/li&gt;
&lt;li&gt;Whats' this Animated Container?&lt;/li&gt;
&lt;li&gt;Implement Hovering effect&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Setting Up Flutter Project
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Go to cmd/terminal and type &lt;code&gt;flutter create &amp;lt;project_name&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 2&lt;/strong&gt;: Type &lt;code&gt;cd &amp;lt;project_name&amp;gt;&lt;/code&gt; in terminal and run flutter pub get&lt;br&gt;
&lt;strong&gt;Step 3&lt;/strong&gt;: Now lets remove this boiler plate code and start working.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tip: You can simply press &lt;code&gt;Ctrl+F&lt;/code&gt; and enable regular expressions (&lt;code&gt;Alt+r&lt;/code&gt;). Type &lt;code&gt;//.*&lt;/code&gt; and all the commented lines will be selected. Now you can replace it with empty space and press Ctrl+F or any key binding you have set for formatting. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ok cool, we are now ready to understand our widgets to be used.&lt;/p&gt;
&lt;h3&gt;
  
  
  Brief Intro to InkWell
&lt;/h3&gt;

&lt;p&gt;InkWell is an amazing material widget in Flutter which comes with many in-built features such as splashColor, onLongPress and many more. Some of the important parameters for our purpose are listed in the table below:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Let's answer some of your questions:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ques1: So why are we using InkWell?&lt;br&gt;
The question lies in the above table. As we can see the InkWell has an onHover function which is called when the user brings in/out the mouse to the widget. &lt;/p&gt;

&lt;p&gt;Ques2: So whats' our idea?&lt;br&gt;
We will be using this amazing feature by InkWell to change the boundaries of the container which will look like a hovering effect.&lt;/p&gt;

&lt;p&gt;Ques3: Hey but the container has fixed height and width and not a good animation too when increasing size. How we will cope up with this?&lt;br&gt;
So that's our next section, Animated Containers. Let's quickly go there.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Whats' this AnimatedContainer?
&lt;/h3&gt;

&lt;p&gt;AnimatedContainer is a special Container that helps us give more wizardly powers to a simple Container. As the name suggests, it is a container with the capabilities to add animations. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Animated version of Container that gradually changes its values over a period of time.                      ---From  &lt;a href="https://api.flutter.dev/flutter/widgets/AnimatedContainer-class.html" rel="noopener noreferrer"&gt;api.flutter.dev&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's look into its arguments:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;So we now are ready with our fundamentals strong. So lets' finally code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's code &amp;amp; implement the hovering effect
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Create a stateful class HoveringWidget. Why Stateful? Because we are going to use AnimatedContainer and it's always better to use Stateful class.&lt;br&gt;
Create an InkWell widget as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class HoveringWidget extends StatefulWidget {
  _HoveringWidgetState createState() =&amp;gt; _HoveringWidgetState();
}

class _HoveringWidgetState extends State&amp;lt;HoveringWidget&amp;gt; {
  @override
  Widget build(BuildContext context) {
    return InkWell(
        child:Text("Hover Button"),
        onTap:(){},
        onHover:(val){} 
         /*val---&amp;gt;true when user brings in mouse
         val---&amp;gt; false when brings out his mouse*/
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;onHover is this function that will be called when a user brings it to the mouse inside/outside. &lt;br&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt; Create a boolean variable isHover and set it to false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bool isHover=false;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Inside onHover function, use setState to change the value of isHover to val.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  setState((){
        isHover=val;
      });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Now we are done with InkWell. So let's wrap this widget inside AnimatedContainer and add duration, padding to it. Carefully look at how I have given padding over here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Widget build(BuildContext context) {
    return AnimatedContainer(
      height:100,//there should be outline/dimensions for the box. 
      //Otherway, You can use positioned widget
      duration: Duration(milliseconds: 200),
      padding: EdgeInsets.only(top: (isHover) ? 25 : 30.0, bottom:!(isHover)? 25:30),
      child: InkWell( 
        onTap:(){},
        child: Text("Hover Button"),
        onHover: (val) {
          setState(() {
            isHover = val;
          });
        },
      ),
      /*val---&amp;gt;true when user brings in mouse
     val---&amp;gt; false when brings out his mouse*/
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the isHover will be true, it will decrease top padding and element will move upwards. With animations, it will look like hovering and will hence create our hovering effect.&lt;/p&gt;

&lt;p&gt;It should be working now!&lt;br&gt;
Now let's do some decoration over InkWell to look better.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: AnimatedContainer(
          height: 70,
          duration: Duration(milliseconds: 200),
          padding: EdgeInsets.only(
              top: (isHover) ? 25 : 30.0, bottom: !(isHover) ? 25 : 30),
          child: Container(
            height: 30,
            color: Colors.blue,
            child: InkWell(
              onTap: () {},
              child: Text("Hover Button"),
              onHover: (val) {
                print("Val---&amp;gt;{}$val");
                setState(() {
                  isHover = val;
                });
              },
            ),
            /*val---&amp;gt;true when user brings in mouse
           val---&amp;gt; false when brings out his mouse*/
          ),
        ),
      ),
    );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Tip: You can add vertical padding to give a slanting hover animation effect.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Kudos 🎉🎉
&lt;/h2&gt;

&lt;p&gt;Hayyyy, you made it till the end. I hope you enjoyed working with animated Containers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FILV8xetoPJO92%2Fgiphy.gif%3Fcid%3Decf05e475ibtssn1gx8squ51hikty5iw8idcnt435t2g7954%26rid%3Dgiphy.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FILV8xetoPJO92%2Fgiphy.gif%3Fcid%3Decf05e475ibtssn1gx8squ51hikty5iw8idcnt435t2g7954%26rid%3Dgiphy.gif%26ct%3Dg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Little Bit About Me🧑‍💻🧑‍💻🧑‍💻
&lt;/h2&gt;

&lt;p&gt;Hey developers, I'm Monikinderjit Singh, working on Flutter for more than a year now. My interest in cloud technology is fueled by my need to learn more about it.  I am currently new to hashnode (this is my second blog post). I would appreciate you giving it a like if you find it interesting and leaving a comment if you have a better solution for this topic. It would be awesome if you could give me some feedback on improving my content.&lt;br&gt;
You can connect with me on my &lt;a href="https://twitter.com/intent/follow?screen_name=monikIJS" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://github.com/Monik09" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and  &lt;a href="https://www.linkedin.com/in/monikinderjit-singh/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; .  &lt;/p&gt;

</description>
      <category>flutter</category>
      <category>animations</category>
      <category>hover</category>
    </item>
    <item>
      <title>Push Notification using Amazon Pinpoint in Flutter</title>
      <dc:creator>Monikinderjit Singh</dc:creator>
      <pubDate>Wed, 01 Sep 2021 14:39:33 +0000</pubDate>
      <link>https://dev.to/monik/push-notification-using-amazon-pinpoint-in-flutter-4a61</link>
      <guid>https://dev.to/monik/push-notification-using-amazon-pinpoint-in-flutter-4a61</guid>
      <description>&lt;p&gt;Amazon Web Services, in early 2021, extended its support for Flutter, which is quite amazing and many new startups have started to use AWS in their flutter applications due to its ease of scalability and support. Amazon Web Service offers a wide variety of options for Flutter, but we're going to focus on Amazon Pinpoint Service today.&lt;/p&gt;

&lt;p&gt;Amazon Pinpoint allow users to send push notifications to multiple recipients. To increase sales, companies and organizations can use marketing campaigns to contact their clients. &lt;/p&gt;

&lt;p&gt;Let's figure out how to integrate this into your Flutter application.&lt;/p&gt;

&lt;h3&gt;
  
  
  What we are going to use💻?
&lt;/h3&gt;

&lt;p&gt;To start, we need to install the following packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;a href="https://pub.dev/packages/firebase_messaging" rel="noopener noreferrer"&gt;firebase_messaging 10.0.5&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pub.dev/packages/flutter_local_notifications" rel="noopener noreferrer"&gt;flutter_local_notifications 8.1.1+1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pub.dev/packages/firebase_core" rel="noopener noreferrer"&gt;firebase_core&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://pub.dev/packages/amplify_core" rel="noopener noreferrer"&gt;amplify_core 0.2.2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pub.dev/packages/amplify_analytics_pinpoint" rel="noopener noreferrer"&gt;amplify_analytics_pinpoint 0.2.2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pub.dev/packages/amplify_flutter" rel="noopener noreferrer"&gt;amplify_flutter 0.2.2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup Amplify Pinpoint
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;To install pinpoint in your amplify project, you will need to add amplify analytics service to your flutter project.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run  &lt;code&gt;amplify add analytics&lt;/code&gt; in your terminal (Make sure you are at root of the project)&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629807379751%2FwJNdQMbnq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629807379751%2FwJNdQMbnq.png" alt="Screenshot_20210824_173824.png"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;code&gt;Amazon Pinpoint service&lt;/code&gt; and then give a name to your pinpoint service resource.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629807291727%2FYMrFis-GT.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629807291727%2FYMrFis-GT.png" alt="Screenshot_20210824_173855.png"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;code&gt;Y&lt;/code&gt; and then click enter. Your amazon pinpoint service will be added locally.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629807691746%2FDynhJlPWC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629807691746%2FDynhJlPWC.png" alt="Screenshot_20210824_175120.png"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, to publish it in the cloud, run &lt;code&gt;amplify push&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Point to be noted: It takes time for amazon analytics to start recording the events. For me, I was able to record events the next morning.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To send notifications from pinpoint, we will need to set up a module that will interact with the app to show the notification. To fulfil this, we have to use &lt;strong&gt;Firebase Cloud Messaging Service&lt;/strong&gt; which will send our notification triggered from Amazon Pinpoint to the user.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Set up Firebase Cloud Messaging
&lt;/h2&gt;

&lt;p&gt;Firebase Console Setup:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open  &lt;a href="https://console.firebase.google.com/u/0/?pli=1" rel="noopener noreferrer"&gt;Firebase Console&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;Create Project&lt;/code&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629808329862%2FHzxw8iel6.png" alt="image.png"&gt;
&lt;/li&gt;
&lt;li&gt;Give a name to your project and press continue.&lt;/li&gt;
&lt;li&gt;Make sure analytics is enabled and then press continue.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629808476598%2FifckB8Yq-.png" alt="image.png"&gt;
&lt;/li&gt;
&lt;li&gt;Select your country and then create your project.&lt;/li&gt;
&lt;li&gt;Register your app and follow the steps described there to successfully register the app. 
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629808805019%2F46ZalyEgH.png" alt="image.png"&gt;
&amp;gt; Extra focus on initializing firebase SDK and google-services.json file&lt;/li&gt;
&lt;li&gt;After your app has been registered, go to Engage-&amp;gt;Cloud Messaging.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629809036364%2FMohwP3J4-.png" alt="image.png"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Let's write some code
&lt;/h2&gt;


&lt;p&gt;&lt;a href="https://giphy.com/gifs/drunkhistory-comedy-central-drunk-history-iFU36VwXUd2O43gdcr" rel="noopener noreferrer"&gt;via GIPHY&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make a file named &lt;code&gt;notifications. dart&lt;/code&gt; and add the following file. In this file, we are handling our notifications from the amazon pinpoint service. &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In main.dart file, call this function &lt;code&gt;_configureAmplify()&lt;/code&gt; inside init state&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;and add these lines in &lt;code&gt;main()&lt;/code&gt; function.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;It's all. Ohh, wait. Let's check how to trigger our notification from Amazon Pinpoint Service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make a notification from Pinpoint Service Webpage
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to your pinpoint service page from your amplify admins page and then click on the pinpoint service you created. Click on Settings-&amp;gt;Push Notifications and enable Firebase Cloud Messaging (FCM). After enabling, there will be a green tick as shown below.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629811928815%2FWFMPWdNML.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629811928815%2FWFMPWdNML.jpeg" alt="Screenshot_20210824_171228.jpg"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Test Messaging and click on &lt;code&gt;Push Notifications&lt;/code&gt;. To send a message we will be requiring a google device token which we are getting using the &lt;code&gt;getToken()&lt;/code&gt; function in the &lt;code&gt;requirements.dart&lt;/code&gt; file. Without this token, we will not be able to send our message. &lt;br&gt;
Write this token inside the &lt;code&gt;Device tokens field&lt;/code&gt;. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629812128290%2FQTa0BNAY2.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629812128290%2FQTa0BNAY2.jpeg" alt="Screenshot_20210824_171101.jpg"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write a message, add a picture URL and send this to the user.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629812122860%2FR9KgH6tII.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1629812122860%2FR9KgH6tII.jpeg" alt="Screenshot_20210824_171142.jpg"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Kudos 🎉🎉
&lt;/h2&gt;

&lt;p&gt;Congratulations to everyone who was able to send their first pinpoint service to trigger the notification. Despite it being a long tutorial, you all made it to the end. &lt;/p&gt;

&lt;h2&gt;
  
  
  Little Bit About Me🧑‍💻🧑‍💻🧑‍💻
&lt;/h2&gt;

&lt;p&gt;Hey developers, I'm Monikinderjit Singh, working on Flutter for more than a year now. My interest in cloud technology is fueled by my need to learn more about it.  I am currently new to hashnode (this is my second blog post). I would appreciate you giving it a like if you find it interesting and leaving a comment if you have a better solution for this topic. It would be awesome if you could give me some feedback on improving my content.&lt;br&gt;
You can connect with me on my &lt;a href="https://twitter.com/monikIJS" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://github.com/Monik09" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and  &lt;a href="https://www.linkedin.com/in/monikinderjit-singh/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; .  &lt;/p&gt;

</description>
      <category>flutter</category>
      <category>aws</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Integrate Amazon Lex With Flutter App</title>
      <dc:creator>Monikinderjit Singh</dc:creator>
      <pubDate>Wed, 01 Sep 2021 14:21:33 +0000</pubDate>
      <link>https://dev.to/monik/integrate-amazon-lex-with-flutter-app-2ed0</link>
      <guid>https://dev.to/monik/integrate-amazon-lex-with-flutter-app-2ed0</guid>
      <description>&lt;p&gt;For industries and companies to maintain an advantage over their competitors, better customer service offers in their mobile apps are crucial. So it is equally important to understand how to integrate a bot in a flutter app. As Amazon is increasing its share in the development of flutter apps with its Amplify service, now integration of Amazon lex with flutter has become easier than ever. &lt;/p&gt;

&lt;p&gt;At this moment, Amplify supports Authentication, Storage, and Analytics for Flutter. &lt;/p&gt;

&lt;p&gt;We will communicate with Lex by using a REST API.&lt;/p&gt;

&lt;h3&gt;
  
  
  What we are going to use💻?
&lt;/h3&gt;

&lt;p&gt;We will be creating a chat with the bot and will be using some amazing packages from  &lt;a href="https://pub.dev/" rel="noopener noreferrer"&gt;flutter pub&lt;/a&gt;  to make our work efficient and easier.&lt;br&gt;
To start, we need to install the following packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;a href="https://pub.dev/packages/http" rel="noopener noreferrer"&gt;http 0.13.3&lt;/a&gt;  : To send request to Amazon Lex&lt;/li&gt;
&lt;li&gt; &lt;a href="https://pub.dev/packages/sigv4" rel="noopener noreferrer"&gt;sigv4 5.0.0&lt;/a&gt;  : To authenticate the service &lt;/li&gt;
&lt;li&gt; &lt;a href="https://pub.dev/packages/uuid" rel="noopener noreferrer"&gt;uuid 3.0.4&lt;/a&gt;  : To create unique uuid &lt;/li&gt;
&lt;li&gt; &lt;a href="https://pub.dev/packages/flutter_chat_ui" rel="noopener noreferrer"&gt;flutter_chat_ui 1.1.9&lt;/a&gt; : To create basic chat UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now our vision is crystal clear and ready to start our project.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/h7dboNZPsoGwRg9bid/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/h7dboNZPsoGwRg9bid/giphy.gif" alt="Ready gif"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Lets' Start
&lt;/h2&gt;

&lt;p&gt;Normally, I set up the backend first, then connect the frontend. Hopefully, you have successfully set up Amazon Lex in AWS.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/2uIlaHVsql55CLP3as/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/2uIlaHVsql55CLP3as/giphy.gif" alt="Let Start "&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Setup Backend File
&lt;/h3&gt;

&lt;p&gt;I have created a file named &lt;code&gt;bot_service.dart&lt;/code&gt; which will contain the code to interact with our lex bot.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'dart:convert';
import 'dart:developer';

import 'package:amazon_cognito_identity_dart_2/sig_v4.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:sigv4/sigv4.dart';

class BotService {
  Map&amp;lt;String,dynamic&amp;gt; result;
  String botName= "&amp;lt;NAME_OF_BOT&amp;gt;";
  String kAccessKeyId = '&amp;lt;ACCESS_KEY&amp;gt;';
  String kSecretAccessKey = '&amp;lt;SECRET_ACCESS_KEY&amp;gt;';
  String botAlias= "&amp;lt;BOT_ALIAS&amp;gt;";
  String botAWSRegion= "&amp;lt;AWS_LEX_REGION&amp;gt;";


  Future&amp;lt;Map&amp;lt;String,dynamic&amp;gt;&amp;gt; callBot(String message) async {
    var response;
    String requestUrl= "https://runtime.lex."+botAWSRegion+".amazonaws.com/bot/"+botName+"/alias/"+botAlias+"/user/1234/text";

    Sigv4Client client = Sigv4Client(
      region: botAWSRegion,
      serviceName: 'lex',
      defaultContentType: 'application/json; charset=utf-8',
      keyId: kAccessKeyId,
      accessKey: kSecretAccessKey,
    );

    final request = client.request(
     requestUrl,
      method: 'POST',
      body: jsonEncode({'inputText': message}),
    );

    response = await http.post(request.url,
        headers: request.headers, body: request.body);
    result = jsonDecode(response.body);
    return result;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Take special care while inserting the required values and region of the Amazon Lex Bot.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;&amp;lt;ACCESS_KEY&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;SECRET_ACCESS_KEY&amp;gt;&lt;/code&gt; you have to insert the value of your Amazon role's secret or you can create a new role for the bot and permit it to call Amazon Lambda Functions(I would prefer to go with creating a new role for the bot).&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Create Chat UI
&lt;/h3&gt;

&lt;p&gt;To create the chat UI, I will use &lt;code&gt;flutter_chat_ui&lt;/code&gt; package as it provides a lot of already built features like handling messages and a chat message model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter_chat_ui/flutter_chat_ui.dart';
import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
import 'package:uuid/uuid.dart';

import './bot_service.dart';

class BotScreen extends StatefulWidget {
  const BotScreen({Key? key}) : super(key: key);

  @override
  _BotScreenState createState() =&amp;gt; _BotScreenState();
}

class _BotScreenState extends State&amp;lt;BotScreen&amp;gt; {
  List&amp;lt;types.Message&amp;gt; messages=[];
  final _user = const types.User(id: '1234556');
  final _bot = const types.User(id: "123");
//id of bot and user doesn't matter here as we have only pair interaction

  BotService _botService = BotService();

  @override
  void initState() {
    super.initState();
    _loadMessages();
  }

  void _addMessage(types.Message message) async {
    setState(() {
      messages.insert(0, message);
    });
    log("${message.toJson()["text"]}");
    var data = await _botService.callBot(message.toJson()["text"]);
    log("#####${data['message']}");
    setState(() {
      messages.insert(0, botMessageReply(data['message']));
    });
  }

  types.Message botMessageReply(String message) {
    return types.TextMessage(
      author: _bot,
      createdAt: DateTime.now().millisecondsSinceEpoch,
      id: const Uuid().v4(),
      text: message,
    );
  }

  void _handleSendPressed(types.PartialText message) {
    final textMessage = types.TextMessage(
      author: _user,
      createdAt: DateTime.now().millisecondsSinceEpoch,
      id: const Uuid().v4(),
      text: message.text,
    );
    _addMessage(textMessage);
  }

  void _loadMessages() async {
    List&amp;lt;types.Message&amp;gt; messagesList = [];
    Future.delayed(Duration(milliseconds: 300), () {
      messagesList.add(types.TextMessage(
        author: _bot,
        createdAt: DateTime.now().millisecondsSinceEpoch,
        id: const Uuid().v4(),
        text: "Hello. My name is TUTU- your bot. How can I help you?",
      ));

      setState(() {
        messages = messagesList;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar:AppBar(automaticallyImplyLeading: false,title:Text("BOT"),backgroundColor:Colors.purpleAccent),
      body: Chat(
        messages: messages,
        showUserNames: true,
        onSendPressed: _handleSendPressed,
        user: _user,
      ),
    );
  }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;`_loadMessages() Function`: This function load messages from the firebase/local file. Here I am pushing a starting message which will be instantiated by the bot when user opens this bot.&lt;/li&gt;
&lt;li&gt;`_addMessage() Function`: This function interacts with bot_service.dart which further interacts with LEX API to get the result of the message sent by the user.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Here is Our Final Product🔥🔥
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;BOT Screen&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1628683299915%2FdxuvYO3nNj.png"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Congratulations🎉
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l49JNZ87F3AmPoH0A/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l49JNZ87F3AmPoH0A/giphy.gif" alt="Congratulations GIF"&gt;&lt;/a&gt;&lt;br&gt;
Great job, you've connected your Flutter app to the Lex bot... well done! &lt;br&gt;&lt;br&gt;
Please let me know if you have any questions or concerns regarding this article and I will do my best to help or learn more.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>aws</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
