<?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: Dhanush Vardhan</title>
    <description>The latest articles on DEV Community by Dhanush Vardhan (@dhanush17tech).</description>
    <link>https://dev.to/dhanush17tech</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%2F1184464%2F1a453fb9-00e2-4446-8e28-b8e69fa80ef2.jpeg</url>
      <title>DEV Community: Dhanush Vardhan</title>
      <link>https://dev.to/dhanush17tech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhanush17tech"/>
    <language>en</language>
    <item>
      <title>Power your Flutter App with Gemini AI ✨</title>
      <dc:creator>Dhanush Vardhan</dc:creator>
      <pubDate>Fri, 16 Feb 2024 08:38:10 +0000</pubDate>
      <link>https://dev.to/dhanush17tech/power-your-flutter-app-with-gemini-ai-na2</link>
      <guid>https://dev.to/dhanush17tech/power-your-flutter-app-with-gemini-ai-na2</guid>
      <description>&lt;h2&gt;
  
  
  Flutter Meets AI: Supercharge Your App with Gemini's Magic ✨
&lt;/h2&gt;

&lt;p&gt;Picture this: your Flutter app, but with a superpower of Google's new AI. I'm talking text that writes itself, images that tell their own stories, and code that practically completes itself! That's the power of Gemini, Google's super cool AI model, and it's ready to level up your app game.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what's this Gemini you speak of?
&lt;/h2&gt;

&lt;p&gt;Think of it as your personal AI genie, granting wishes in the form of text generation, image analysis, and even code understanding. This means you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Craft personalized content:&lt;/strong&gt; Imagine your app writing product descriptions that adapt to each user, or summarizing news articles for quick reads. Boom! Instant engagement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make images come alive:&lt;/strong&gt; Let Gemini automatically caption user-uploaded pics, or use them to search for similar products. Visual magic, unlocked! ‍♀️&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Become a coding ninja:&lt;/strong&gt; Get AI-powered suggestions and autocompletion, making you a coding rockstar. Plus, debug like a pro with code comprehension tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ready to get your AI groove on?
&lt;/h2&gt;

&lt;p&gt;No need for complicated spells! Here's the breakdown:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Pick your AI playground:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vertex AI:&lt;/strong&gt; Google's easy-to-use platform for accessing Gemini, like renting a pre-built castle for your AI party.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Cloud Functions:&lt;/strong&gt; More control for the tech-savvy wizards, build your own custom AI fortress!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connect the dots:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;google_generative_ai:&lt;/code&gt; This handy package is like a magic wand for talking to Gemini from your Flutter app. ✨&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DIY with HTTP:&lt;/strong&gt; Want more control over the spells? Use this code library for custom API calls. 🪄&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Let's do some AI-fu!
&lt;/h2&gt;

&lt;p&gt;Here's a taste of how to generate text with &lt;code&gt;google_gemini&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let's first install the package! Open up your terminal in the root folder of your Flutter project and run this code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flutter pub add google_gemini
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Get your &lt;a href="https://ai.google.dev/"&gt;API Key here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you get that done, let's get coding&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="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:google_gemini/google_gemini.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Future&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;writeMeASong&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;gemini&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GoogleGemini&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nl"&gt;apiKey:&lt;/span&gt; &lt;span class="s"&gt;"&amp;lt;---Your-API-Key---&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;gemini&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;generateFromText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Write me a song"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;mySong&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;writeMeASong&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"cats and dogs"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mySong&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Now you have an AI-generated song!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;But wait, there's more!&lt;/p&gt;

&lt;p&gt;Combine text and images for even cooler stuff, like generating stories based on pictures.&lt;/p&gt;

&lt;p&gt;Train Gemini to understand your app's specific lingo for even more personalized magic.&lt;/p&gt;

&lt;h1&gt;
  
  
  Remember, with great AI power comes great responsibility...:
&lt;/h1&gt;

&lt;p&gt;Use Gemini ethically and for good.&lt;/p&gt;

&lt;p&gt;Keep an eye on those API costs, don't go bankrupt building your AI!&lt;br&gt;
Respect user privacy, data is precious!&lt;br&gt;
So, are you ready to unleash the power of AI in your Flutter app? Dive in, experiment, and see what amazing things you can create! With Gemini by your side, the possibilities are endless.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>flutter</category>
      <category>android</category>
      <category>ios</category>
    </item>
    <item>
      <title>Flutter's Provider: The Superhero of State Management!</title>
      <dc:creator>Dhanush Vardhan</dc:creator>
      <pubDate>Sat, 18 Nov 2023 08:28:50 +0000</pubDate>
      <link>https://dev.to/dhanush17tech/flutters-provider-the-superhero-of-state-management-2g67</link>
      <guid>https://dev.to/dhanush17tech/flutters-provider-the-superhero-of-state-management-2g67</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QA5chNj3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://media.tenor.com/6dAYTNjtgm0AAAAC/supergirl-save.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QA5chNj3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://media.tenor.com/6dAYTNjtgm0AAAAC/supergirl-save.gif" alt="Image" width="498" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Provider? 🤔
&lt;/h2&gt;

&lt;p&gt;Imagine you're at a buffet (yum!). You have a plate (your app screen) and a variety of dishes (data) to choose from. Now, you don't cook a new dish every time you want to eat (that's just exhausting!). Instead, you go to the buffet (Provider) and pick what you need. Easy peasy! Provider in Flutter is like this buffet. &lt;strong&gt;It's a central spot where your app's data is stored, ready to be used by different widgets.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's use a real-life analogy to explain this concept:&lt;/p&gt;

&lt;p&gt;Imagine you're building a to-do list app. In this app, you have a list of tasks that you want to display on different screens, like the home screen and a detail screen for each task. You also want to be able to add, edit, or delete tasks from any screen.&lt;/p&gt;

&lt;p&gt;Now, think of the Provider as a bucket. This bucket contains your list of tasks. Every time you make a change to this bucket, it automatically updates all the screens in your app that are interested in the task list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Provider? 🚀
&lt;/h2&gt;

&lt;p&gt;Using &lt;strong&gt;setState&lt;/strong&gt; everywhere in Flutter can be like using a hammer for every problem - not ideal! It can lead to performance issues and make your app as slow as a sloth on a lazy day. Provider to the rescue! &lt;strong&gt;It separates your app's brain (logic) from its beauty (UI), keeping your code clean, organized, and as pretty as a picture.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Provider in a Todo/Task App
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Import Dependency
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="nl"&gt;dependencies:&lt;/span&gt;
  &lt;span class="nl"&gt;provider:&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Create a Model Class for Our Task
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Task&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="kd"&gt;required&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;required&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Creating a Provider
&lt;/h3&gt;

&lt;p&gt;You create a provider by defining a class that holds the data you want to share, in this case, your task list.&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TaskProvider&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;ChangeNotifier&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_tasks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="c1"&gt;// Methods to add, edit, or delete tasks go here&lt;/span&gt;

  &lt;span class="c1"&gt;// Getter to access the task list&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;tasks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_tasks&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Method to add a new task&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;addTask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="n"&gt;newTask&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;_tasks&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newTask&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;notifyListeners&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Notify listeners to rebuild widgets&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Initializing the Provider
&lt;/h3&gt;

&lt;p&gt;You create an instance of your provider class and make it available to your app. This is typically done at the root of your app using a &lt;code&gt;ChangeNotifierProvider&lt;/code&gt;.&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="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;runApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;ChangeNotifierProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;create:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;TaskProvider&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
      &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Accessing Data
&lt;/h3&gt;

&lt;p&gt;Now, any widget in your app can access the task list from the provider. For example, your home screen can display the list of tasks like this:&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="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;tasks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Provider&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;TaskProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Updating Data
&lt;/h3&gt;

&lt;p&gt;When you add, edit, or delete a task, you do it through the provider. The provider updates its internal data and automatically notifies all the widgets that are listening to it. For example, when you add a new task:&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="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;taskProvider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Provider&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;TaskProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;taskProvider&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addTask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newTask&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  7. Widget Rebuild
&lt;/h3&gt;

&lt;p&gt;When the provider notifies that the data has changed, widgets that depend on that data will automatically rebuild to reflect the updated information. So, your home screen will refresh to display the new task you added.&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;ListView&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nl"&gt;itemCount:&lt;/span&gt; &lt;span class="n"&gt;taskProvider&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;itemBuilder:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;taskProvider&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ListTile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;subtitle:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  That's it you aced this!!! It was that simple
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Conclusion 🌈
&lt;/h2&gt;

&lt;p&gt;So, next time you dive into a Flutter project, remember the Provider - your data management superhero! With Provider, managing state is as smooth as spreading butter on warm toast. Happy Fluttering 🎉✨🚀&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>provider</category>
      <category>android</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Simplifying CRUD Operations with Firestore and Flutter: A Beginner's Guide</title>
      <dc:creator>Dhanush Vardhan</dc:creator>
      <pubDate>Tue, 07 Nov 2023 05:32:12 +0000</pubDate>
      <link>https://dev.to/dhanush17tech/simplifying-crud-operations-with-firestore-and-flutter-a-beginners-guide-57b1</link>
      <guid>https://dev.to/dhanush17tech/simplifying-crud-operations-with-firestore-and-flutter-a-beginners-guide-57b1</guid>
      <description>&lt;p&gt;Welcome, Flutter enthusiasts and future mobile app developers! If you're looking to create dynamic, scalable, and real-time mobile applications, learning how to perform CRUD (Create, Read, Update, Delete) operations with Firestore in Flutter is essential. This beginner-friendly guide will walk you through the fundamental steps of integrating Firestore with Flutter and how to work with photos within your app.&lt;/p&gt;

&lt;p&gt;Before diving in, make sure you have the following ready:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A basic understanding of Dart and Flutter.&lt;/li&gt;
&lt;li&gt;Flutter installed on your machine.&lt;/li&gt;
&lt;li&gt;And make sure you were your thinking caps !!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Create a Firebase Project
&lt;/h2&gt;

&lt;p&gt;Navigate to your Firebase Console and click Add Project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QnzpWD7A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/an64chk2dxmit0l9ph3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QnzpWD7A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/an64chk2dxmit0l9ph3d.png" alt="Create Firebase Project 1" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Setup Your Firebase Project
&lt;/h2&gt;

&lt;p&gt;Give your project a name and enable google analytics.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cbw0stDy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68jutmrmzx7abbmk0dae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cbw0stDy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68jutmrmzx7abbmk0dae.png" alt="Create Firebase Project 2" width="800" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dU_4QcCM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zej57sxtn1ykbkqxxypw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dU_4QcCM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zej57sxtn1ykbkqxxypw.png" alt="Create Firebase Project 3" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kDW9pM91--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3md1p8mlqxd658b89vr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kDW9pM91--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3md1p8mlqxd658b89vr0.png" alt="Create Firebase Project 4" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Connecting the Flutter App to the Firebase Project
&lt;/h2&gt;

&lt;p&gt;To connect the flutter app to firebase, &lt;strong&gt;we must install firebase-cli. (PS: this requires nodejs to be installed &lt;a href="https://nodejs.org/en/download"&gt;https://nodejs.org/en/download&lt;/a&gt;)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="nx"&gt;firebase&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;tools&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;firebase&lt;/span&gt; &lt;span class="nx"&gt;login&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go ahead and click the Flutter icon on the dashboard of your firebase project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---ibHw0uX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i3ttgnu23lu4rccwwtt9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---ibHw0uX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i3ttgnu23lu4rccwwtt9.png" alt="Connect Flutter App to Firebase 1" width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wIdihY-O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/at8ch4tcs8kq6nrrrjta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wIdihY-O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/at8ch4tcs8kq6nrrrjta.png" alt="Connect Flutter App to Firebase 2" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the commands and you'll have your Firebase Project connected to your Flutter App&lt;/p&gt;

&lt;p&gt;Now navigate to &lt;code&gt;main.dart&lt;/code&gt; and paste this code just above your &lt;code&gt;runApp()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MVt3k9y5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3jo3z0uw3l3gmsmwruv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MVt3k9y5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3jo3z0uw3l3gmsmwruv.png" alt="Initialize Firebase in Flutter App" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesssgoooo 🎉 you've SUCCESSFULLY Connected your Flutter app to Firebase
&lt;/h2&gt;

&lt;p&gt;Now you just have to navigate to Firestore and enable the feature&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FpIubDx6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhkpi7uets25lphjuhm3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FpIubDx6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhkpi7uets25lphjuhm3.png" alt="Firestore Enabling" width="800" height="267"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2v8yMunl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lxvahub9rgwjwbnaiun6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2v8yMunl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lxvahub9rgwjwbnaiun6.png" alt="Firestore Enabling 2" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 4: Adding Dependencies
&lt;/h2&gt;

&lt;p&gt;First, add the necessary Firestore package to your pubspec.yaml file:&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="nl"&gt;dependencies:&lt;/span&gt;
  &lt;span class="nl"&gt;flutter:&lt;/span&gt;
    &lt;span class="nl"&gt;sdk:&lt;/span&gt; &lt;span class="n"&gt;flutter&lt;/span&gt;
  &lt;span class="nl"&gt;cloud_firestore:&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="n"&gt;latest_version&lt;/span&gt;
  &lt;span class="nl"&gt;firebase_storage:&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="n"&gt;latest_version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After saving the file, run flutter pub get in your terminal to install the packages.&lt;/p&gt;

&lt;h2&gt;
  
  
  CRUD Operations
&lt;/h2&gt;

&lt;p&gt;Create (Adding Data)&lt;br&gt;
To add data to Firestore, you'll use the collection and add methods:&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;FirebaseFirestore&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'users'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="s"&gt;'name'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'Jane Doe'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s"&gt;'age'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s"&gt;'email'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'jane.doe@example.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read (Retrieving Data)&lt;br&gt;
To fetch data, you'll use collection and get:&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;FirebaseFirestore&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'users'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;querySnapshot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;querySnapshot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;docs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update (Modifying Data)&lt;br&gt;
For updating a document, you'll need its ID:&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;FirebaseFirestore&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'users'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;documentId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;update&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="s"&gt;'age'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Delete (Removing Data)&lt;br&gt;
To delete a document, also use the document's ID:&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;FirebaseFirestore&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'users'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;documentId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Integrating Photos with Firestore and Flutter&lt;br&gt;
Working with photos involves storing the images in Firebase Storage and keeping references in Firestore.&lt;/p&gt;
&lt;h2&gt;
  
  
  Uploading Images
&lt;/h2&gt;

&lt;p&gt;Apart from just Firestore, Firebase offers a lot of other features to like Firebase Storage and much more....&lt;/p&gt;

&lt;p&gt;Now lets take a loot at how to use Firebase Storage!!&lt;/p&gt;

&lt;p&gt;Step 1: Uploading Images into the Firebase Storage&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;FirebaseStorage&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FirebaseStorage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;TaskSnapshot&lt;/span&gt; &lt;span class="n"&gt;snapshot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'uploads/user-profile.jpg'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;putFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;imageFile&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;downloadUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;snapshot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getDownloadURL&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Storing Image URLs in Firestore&lt;br&gt;
After uploading, save the image URL to Firestore:&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;FirebaseFirestore&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'users'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;update&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="s"&gt;'profileImageUrl'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;downloadUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3: Displaying Images in Flutter&lt;br&gt;
To display the image, use the Image.network widget with the Firestore URL:&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;Image&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;network&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;downloadUrl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;You now have a foundational understanding of CRUD operations in Firestore with Flutter and how to integrate photos into your app. As you continue your journey, remember that practice is key to mastery. Keep experimenting, building, and learning.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>firebase</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What is Flutter, how do I get started ??!!!</title>
      <dc:creator>Dhanush Vardhan</dc:creator>
      <pubDate>Fri, 13 Oct 2023 22:01:32 +0000</pubDate>
      <link>https://dev.to/dhanush17tech/what-is-flutter-how-do-i-get-started--3ijl</link>
      <guid>https://dev.to/dhanush17tech/what-is-flutter-how-do-i-get-started--3ijl</guid>
      <description>&lt;p&gt;&lt;a href="http://www.youtube.com/watch?v=s4VScWsR5OY"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t1v3brsV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/dhanush17-tech/Profinity-Dectector-and-Image-Moderator/master/Untitled%2520design%281%29.png" alt="Basics of Flutter" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Flutter is gaining a lot of hype now, but &lt;strong&gt;what is it in the first place, is it hard to learn, is it worth the learning???&lt;/strong&gt; Don't worry, I've got you &lt;/p&gt;

&lt;p&gt;Flutter is a cross-platform development toolkit, basically, you only need to code once but you'll have an app ready to ship for both Android and IOS mainly!! Well, that's amazing but what about the performance? Performance is not even a doubt, Flutter gets really close to native app performance and renders apps at 60fps, that's just as smooth as butter!!🧈🧈&lt;/p&gt;

&lt;h2&gt;
  
  
  Now let's get coding
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JPRm1xGa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://media0.giphy.com/media/mcsPU3SkKrYDdW3aAU/200w.gif%3Fcid%3D6c09b952tuubri34slkr2o1hx8qb6xfhli0xgnp4d58xs7v3%26ep%3Dv1_gifs_search%26rid%3D200w.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JPRm1xGa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://media0.giphy.com/media/mcsPU3SkKrYDdW3aAU/200w.gif%3Fcid%3D6c09b952tuubri34slkr2o1hx8qb6xfhli0xgnp4d58xs7v3%26ep%3Dv1_gifs_search%26rid%3D200w.gif%26ct%3Dg" alt="coding gif" width="200" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Everything in Flutter is a widget, in fact, the screen itself is a widget&lt;/strong&gt;. Now let's create our first app in Flutter&lt;/p&gt;

&lt;p&gt;Go to your terminal and hit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flutter create counter_app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eDUxu8M6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ffmqklm9kuxknsc7s8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eDUxu8M6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ffmqklm9kuxknsc7s8i.png" alt="terminal image" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that you've created the Flutter project, drag and drop the folder in VS Code.&lt;/p&gt;

&lt;p&gt;Navigate to &lt;strong&gt;main.dart&lt;/strong&gt; in the &lt;strong&gt;lib&lt;/strong&gt; folder and run the project on an emulator&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pf-xfl8Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79851y30twdsczz6dkb4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pf-xfl8Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79851y30twdsczz6dkb4.png" alt="counter app" width="358" height="659"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I know the code looks very intimidating, but that's why I'm here to help you out.&lt;/p&gt;

&lt;p&gt;The first thing you should notice is the &lt;strong&gt;StatelessWidget&lt;/strong&gt; and &lt;strong&gt;StatefulWidget&lt;/strong&gt; in the code. To put it in a simple way, StatefulWidget is used when the content on the screen needs to be dynamic or in other words the state needs to be altered. StatelessWidget is used when you don't want any change in the screen's content. Yes, it's as simple as that!!!&lt;/p&gt;

&lt;p&gt;If you want to create a StatefulWidget, just type &lt;code&gt;stf&lt;/code&gt; and your code editor will generate the code for you. If you want a StatelessWidget, you should type &lt;code&gt;stl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now you see you have a function called &lt;code&gt;_incrementCounter&lt;/code&gt;  which has &lt;code&gt;setState&lt;/code&gt; in it. Now what on earth is that?!!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FysVPa5b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ufbakvte0o2y3ifev9r2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FysVPa5b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ufbakvte0o2y3ifev9r2.png" alt="function image" width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As the name says &lt;code&gt;setState&lt;/code&gt; is used to &lt;strong&gt;set the state&lt;/strong&gt; of a variable. In this app, we want to increment the state of the counter variable every time we hit the increment button hence we are using &lt;code&gt;setState&lt;/code&gt; to change the state of the &lt;code&gt;_counter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now let's take a look at the other crazy stuff we have in our app&lt;/p&gt;

&lt;p&gt;As I told you before, &lt;strong&gt;everything in Flutter is a widget&lt;/strong&gt; the &lt;code&gt;MyHomePage&lt;/code&gt; screen itself is a widget. Inside the &lt;code&gt;MyHomePage&lt;/code&gt; widget/screen, we need to add more widgets to display content on the screen. Starting with the &lt;code&gt;Scaffold&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scaffold: This widget basically provides you a canvas to place all the other widgets you need in an app. For example, if you are going to a Supermarket to get some snacks for your weekend Netflix, you will definitely need a bag to place all your snacks. The bag here is your Scaffold and the other snacks you'll want inside the bag can be the other widgets. These snacks will be placed inside the &lt;code&gt;body&lt;/code&gt; property of your &lt;code&gt;Scaffold&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Text: As the name itself says, a Text widget will help you place text on the screen&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But what should I do to place these widgets in the order I want??!!! That's why we've got the &lt;strong&gt;Layout Widgets&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We have Column, Row, Stack, and many more...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cSttJKOW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch3ioacnbalwfzvs4hnl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cSttJKOW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch3ioacnbalwfzvs4hnl.png" alt="widgets" width="795" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But what are &lt;code&gt;children&lt;/code&gt; and &lt;code&gt;child&lt;/code&gt; that I can see in these Layout Widgets??!!!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;children&lt;/code&gt; is just a property that takes a &lt;strong&gt;list of widgets&lt;/strong&gt; that needs to be placed in a Layout Widget.&lt;br&gt;
&lt;code&gt;child&lt;/code&gt; is a property that takes a &lt;strong&gt;single widget&lt;/strong&gt; that needs to be placed in a Layout Widget.&lt;/p&gt;

&lt;p&gt;Now you know everything that you need to start &lt;strong&gt;dashing&lt;/strong&gt; with &lt;strong&gt;Flutter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's it guys, you've nailed this!!!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There is a bucket load of widgets that Flutter offers you, check them out at &lt;a href="https://docs.flutter.dev/reference/widgets"&gt;Flutter Widget Catalog&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you are already starting to love Flutter &lt;strong&gt;&lt;a href="https://www.youtube.com/watch?v=s4VScWsR5OY&amp;amp;t=1258s"&gt;Check out my Video&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="https://topmate.io/dhanush_vardhan"&gt;Schedule a meeting with me&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>google</category>
      <category>firebase</category>
      <category>firestore</category>
    </item>
  </channel>
</rss>
