<?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: Hemunt Sharma</title>
    <description>The latest articles on DEV Community by Hemunt Sharma (@hemunt_sharma).</description>
    <link>https://dev.to/hemunt_sharma</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%2F982318%2F6be0e9c6-51ca-4fbb-953f-279465d1d81b.jpg</url>
      <title>DEV Community: Hemunt Sharma</title>
      <link>https://dev.to/hemunt_sharma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hemunt_sharma"/>
    <language>en</language>
    <item>
      <title>Flutter Toast vs Snackbar</title>
      <dc:creator>Hemunt Sharma</dc:creator>
      <pubDate>Thu, 01 Dec 2022 06:28:36 +0000</pubDate>
      <link>https://dev.to/hemunt_sharma/flutter-toast-vs-snackbar-24nb</link>
      <guid>https://dev.to/hemunt_sharma/flutter-toast-vs-snackbar-24nb</guid>
      <description>&lt;p&gt;What is a toast message in an android application? It is just a message that is displayed on the top of the screen for a short time. This is the simplest meaning of the &lt;a href="https://www.flutterdecode.com/flutter-toast-message-how-to-show-a-toast-message-in-a-flutter/"&gt;toast message&lt;/a&gt; and in a flutter, the toast message has the no different meaning it is the same as I described above.&lt;/p&gt;

&lt;p&gt;And what is a &lt;a href="https://www.flutterdecode.com/flutter-snackbar-example/"&gt;Snackbar&lt;/a&gt; in flutter? It is also a way to communicate with the user or display a message to the user but with the snackbar your user can interact with the app by doing certain things. Snackbar can be used in areas where simple external information is required with options to use. For example: In the GMail application, when you delete a message, a quick snackbar with the option message ‘Deleted’ and ‘Restore’ displays on the top of the mobile screen. After clicking the ‘Restore’ button, the deleted information will be restored.&lt;/p&gt;

&lt;p&gt;You can compare Toast vs Snackbar in android development with using java but in flutter showing a snackbar and showing a toast message are the same thing although there is a package in flutter especially for displaying the toast message on the screen just like the toast message from java. And you can use this package to display a toast message.&lt;/p&gt;

&lt;p&gt;Use this &lt;a href="https://pub.dev/packages/fluttertoast"&gt;plugin&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fluttertoast.showToast(

msg: “This is a Toast message”, // message

toastLength: Toast.LENGTH_SHORT, // length

gravity: ToastGravity.CENTER, // location

timeInSecForIos: 1 // duration

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

&lt;/div&gt;



&lt;p&gt;For displaying a snackbar in flutter you don’t need any extra package. Flutter comes with a pre-define snackbar property in scaffold widget of the app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ScaffoldMessenger.of(context).showSnackBar(
 SnackBar(

  content: Text(“Sending Message”),

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

&lt;/div&gt;



&lt;p&gt;if you use the flutter toast package then here is a little comparison between toast and snackbar. In my opinion, if your goal is to show warnings or information that requires user interaction/confirmation, then you should use a snackbar. If it’s just information that doesn’t require user authentication, you can use a toast message.&lt;/p&gt;

&lt;h2&gt;
  
  
  #TOAST
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;You can not dismiss by swiping&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Widget not required (Can show in the android home or above other apps)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can not handle user input&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Best to show info messages to the user&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  #Snackbar
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;It can be dismissed by swiping&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can only be displayed inside the app widget or activity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can easily handle user input&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Good for showing warning/info type messages to the user that needs attention&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can use whatever you want to show the message but in my opinion, I would rather use snackbar for displaying the message because it gives the ability to interact with the user, and by using snackbar we can do lots of stuff that can not be done using flutter toast.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to add a static widget at the end of ListView In Flutter</title>
      <dc:creator>Hemunt Sharma</dc:creator>
      <pubDate>Thu, 01 Dec 2022 06:22:45 +0000</pubDate>
      <link>https://dev.to/hemunt_sharma/how-to-add-a-static-widget-at-the-end-of-listview-in-flutter-2p62</link>
      <guid>https://dev.to/hemunt_sharma/how-to-add-a-static-widget-at-the-end-of-listview-in-flutter-2p62</guid>
      <description>&lt;p&gt;Here are some steps&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First Add LsitView to your code, Make its children&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create one Nested Listview Builder For the rest of the Listview elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure to add Property — (Physics: ScrollPhysics(), shrinkWrap: true) To ListView builder&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Below that listView builder Create the Footer widget(Container).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wrap the ListView Builder and Footer widget in the children of the First created ListView&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Below is the Example Code for this&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I Crested the List of the Rest of the Widgets And the footer Widget was Created Separately&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  List listTiles = ["A", "B", "C", "C"];

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ListView(
          children: &amp;lt;Widget&amp;gt;[

            //Rest of the elements
            ListView.builder(
              physics: ScrollPhysics(),
              shrinkWrap: true,
              itemCount: listTiles.length,
              itemBuilder: (BuildContext context, int index) {
                return Container(
                  color: Colors.green,
                  height: 60,
                  child: Center(
                    child: Text(
                      '${listTiles[index]}',
                      style: const TextStyle(color: Colors.black, fontSize: 16),
                    ),
                  ),
                );
              },
            ),

            //Footer widget or other Static Widget after list view
            Container(
              height: 40,
              color: Colors.redAccent,
              child:  const Center(
                child: Text(
                  'Footer',
                  style: TextStyle(color: Colors.white, fontSize: 16),
                ),
              ),
            ),
          ],
        ),

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

&lt;/div&gt;



&lt;p&gt;This is Just one way To do it But here is &lt;a href="https://www.flutterdecode.com/how-to-add-static-widget-at-end-of-listview-builder-flutter-code-example/"&gt;How to add a static widget at end of ListView builder flutter&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Create table In SQLite Database in a flutter</title>
      <dc:creator>Hemunt Sharma</dc:creator>
      <pubDate>Thu, 01 Dec 2022 06:19:36 +0000</pubDate>
      <link>https://dev.to/hemunt_sharma/how-to-create-table-in-sqlite-database-in-a-flutter-7df</link>
      <guid>https://dev.to/hemunt_sharma/how-to-create-table-in-sqlite-database-in-a-flutter-7df</guid>
      <description>&lt;p&gt;SQLite is the Plugin that stores the data in the device in the form of Tables.&lt;/p&gt;

&lt;p&gt;It helps to maintain the data in rows and columns in the Mobile local directory. we can run &lt;a href="https://blog.hubspot.com/marketing/sql-tutorial-introduction"&gt;SQL queries&lt;/a&gt; to perform CRUD operations (Create, Read, Update, delete)&lt;/p&gt;

&lt;p&gt;So to start Using the Sqlite in flutter add the plugin in the dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies:
  flutter:
    sdk: flutter

#dependencie of SQLITE
  sqflite: ^2.2.0+3
  path_provider: ^2.0.11

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

&lt;/div&gt;



&lt;p&gt;Then make a separate file for using all the database queries and creating a database.&lt;/p&gt;

&lt;p&gt;Import the statements and create the database helper class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';


class DatabaseHelper{

}

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

&lt;/div&gt;



&lt;p&gt;In this class create the future method for creating a database and which will return the database when needed.&lt;/p&gt;

&lt;p&gt;There is an openDatabase() function that comes in the SQLite package, which takes three parameters. first takes the path of the database where the database file will be stored and the second one takes the onCreate call back function which calls when the database is not there in the provided path and needs to be created. third is the version that takes the integer value.&lt;/p&gt;

&lt;p&gt;Here is the function for that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  final String _tableName = "users";

  Future&amp;lt;Database&amp;gt; getDataBase() async {
    return openDatabase(
      join(await getDatabasesPath(), "usersDatabase.db"),
      onCreate: (db, version) async {
        await db.execute(
          "CREATE TABLE $_tableName (id TEXT PRIMARY KEY, name TEXT, imageUrl TEXT)",
        );
      },
      version: 1,
    );
  }

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

&lt;/div&gt;



&lt;p&gt;Also created one variable that stores the table name.&lt;/p&gt;

&lt;p&gt;So here is how to create the Database function which creates the local database table.&lt;/p&gt;

&lt;p&gt;See how to &lt;a href="https://www.flutterdecode.com/flutter-sqlite-crud-example/"&gt;flutter SQLite CRUD operations&lt;/a&gt; are performed with Example Code.&lt;/p&gt;

&lt;p&gt;Thank you for reading&lt;/p&gt;

&lt;p&gt;Happy Fluttering&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
