<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sanskar Tiwari on Medium]]></title>
        <description><![CDATA[Stories by Sanskar Tiwari on Medium]]></description>
        <link>https://medium.com/@indianappguy?source=rss-ae50a8b1352------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FDSg4uS4tUtFni4Bymilyg.jpeg</url>
            <title>Stories by Sanskar Tiwari on Medium</title>
            <link>https://medium.com/@indianappguy?source=rss-ae50a8b1352------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 23:15:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@indianappguy/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Turn any video into a presentation in seconds using AI]]></title>
            <link>https://medium.com/magicslides-app/turn-any-video-into-a-presentation-in-seconds-using-ai-70493c2c8721?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/70493c2c8721</guid>
            <category><![CDATA[presentations]]></category>
            <category><![CDATA[presentation-tips]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 12:23:54 GMT</pubDate>
            <atom:updated>2025-04-02T12:23:54.739Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="create presentation from youtube video using ai with magicslides app" src="https://cdn-images-1.medium.com/max/1024/1*v5ensTFxrPqn3Fzxg_1dTQ.jpeg" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FY08idaXjWi8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DY08idaXjWi8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FY08idaXjWi8%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0be4c2ff31769c18045a8cf1ee98c528/href">https://medium.com/media/0be4c2ff31769c18045a8cf1ee98c528/href</a></iframe><p>Have you ever wished you could instantly convert informative videos into well-designed presentations? Now you can with MagicSlides, the AI-powered tool that’s revolutionizing how we create presentations.</p><h3>What Makes MagicSlides Special?</h3><p>MagicSlides uses advanced AI to analyze your videos frame by frame, extracting key insights and automatically generating professional slides. The best part? There’s no manual work required on your end.</p><p>The process is remarkably simple:</p><ol><li>Upload your video</li><li>Let the AI analyze the content</li><li>Receive a beautifully designed, editable presentation</li></ol><p>Whether you’re working with YouTube tutorials, recorded lectures, or your own content, MagicSlides handles it all with support for over 100 languages.</p><h3>Perfect For Everyone</h3><p>This tool is a game-changer for:</p><ul><li>Educators looking to convert lectures into study materials</li><li>Content creators repurposing video content</li><li>Trainers creating concise learning materials</li><li>Busy professionals who want to save hours on presentation design</li></ul><h3>Key Features</h3><ul><li><strong>Automated Content Extraction</strong>: No need to manually summarize or write content</li><li><strong>Intelligent Context Analysis</strong>: The AI watches your video, understands the context, and writes detailed descriptions</li><li><strong>Professional Templates</strong>: Generate presentations using sleek, professional designs</li><li><strong>All-in-One Platform</strong>: Edit, customize, and present — everything happens in one place</li></ul><h3>How It Works</h3><p>Our recent tutorial walks through the entire process:</p><p><strong>Introduction and Overview</strong> (0:00–0:15) Get acquainted with MagicSlides and what you can expect from the tool.</p><p><strong>Uploading Your Video</strong> (0:15–0:47) Learn how to quickly upload and prepare your video for AI analysis.</p><p><strong>AI Analysis Process</strong> (0:47–1:20) Discover how the AI breaks down your video to extract meaningful content.</p><p><strong>Template Selection</strong> (1:20–1:45) Explore the variety of professional templates available for your presentation.</p><p><strong>Presentation Generation</strong> (1:45–2:10) Watch as MagicSlides transforms your video into a complete presentation.</p><p><strong>Customization Options</strong> (2:10–2:30) Learn how to edit and add final touches to your AI-generated slides.</p><p><strong>Conclusion</strong> (2:30+) Final thoughts and recommendations for getting the most out of MagicSlides.</p><h3>Get Started Today</h3><p>Ready to transform how you create presentations? Try MagicSlides for free and create your first AI-powered presentation from videos, PDFs, URLs, and more — all with just a few clicks.</p><p>Share your creations with us on Twitter @indianappguy!</p><p><a href="https://claude.ai/chat/1a2902f1-16a4-41f7-841f-88a1d8b02f82#">Visit the MagicSlides Website →</a></p><p><em>Subscribe to our newsletter for early access to new features and updates, and don’t forget to check out our YouTube channel for more tutorials and AI-powered tools!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70493c2c8721" width="1" height="1" alt=""><hr><p><a href="https://medium.com/magicslides-app/turn-any-video-into-a-presentation-in-seconds-using-ai-70493c2c8721">Turn any video into a presentation in seconds using AI</a> was originally published in <a href="https://medium.com/magicslides-app">MagicSlides App</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Got a Topic? Instantly Get a Ready-to-Go Presentation with AI and Google]]></title>
            <link>https://indianappguy.medium.com/got-a-topic-instantly-get-a-ready-to-go-presentation-with-ai-and-google-ffa5d7e11118?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffa5d7e11118</guid>
            <category><![CDATA[ppt]]></category>
            <category><![CDATA[pdf-to-ppt]]></category>
            <category><![CDATA[ai-slides]]></category>
            <category><![CDATA[pptx]]></category>
            <category><![CDATA[ai-presentation]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Sun, 08 Dec 2024 07:48:52 GMT</pubDate>
            <atom:updated>2024-12-08T07:48:52.074Z</atom:updated>
            <content:encoded><![CDATA[<p>If you already have a topic for your presentation, you could start from scratch, but that would take much longer. Instead,</p><p>why not use the available tools that can give you a draft that’s about <strong>80%</strong> ready? All you’ll need to do is make a few quick tweaks, and you’ll have a complete presentation in under 20 minutes — far less time than it would take doing everything by hand.</p><p>Before i go on and on first have a look at what you can make if you just decided to spend next 5 min following this blog</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PUsgBBp3id_ZIs29-SOyOQ.png" /><figcaption>checkout <a href="https://www.magicslides.app/ppt-templates">ppt templates</a> by magicslides.app</figcaption></figure><p>Excited? Let’s go</p><p><strong>Step 1:</strong> Visit MagicSlides and <strong>Sign up</strong></p><p>sign up with Google (1 click less than 2.5 sec spend) or use Email</p><p>visit here to <a href="https://www.magicslides.app/signup"><strong><em>sign up for magicslides</em></strong></a></p><p><strong>Step 2: </strong>Create PPT</p><p>So after signup you will be on homepage where you will see a big text box area to enter the topic, a lot’s of text (if you already have done your research) or youtube url and you can even upload files</p><figure><img alt="landing page magicslides app, which shows a big text space to write the topic or the text to create presentation" src="https://cdn-images-1.medium.com/max/1024/1*oI3oQevEGW1YYC2nKxQ-FA.png" /></figure><p>But wait let’s go step by step</p><p>Creating presentation with MagicSlides Using Content from google</p><ol><li>Write the topic</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcD8hvy_yOMWD-bcibSOfA.png" /><figcaption>wrote the topic in the input field</figcaption></figure><p>2. Choose Template</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yTy2WtT2H0BJ_LuK0cQKfw.png" /></figure><p>3. Toggle “Get data from Google text”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uVbbb8dnHi7gydx3nfpdsQ.png" /></figure><p>4. Hit <strong>Generate Presentation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TqbqOMIStP9fNe1byvXHww.png" /></figure><p>that’s it can it be easier? let us know at support@magicslides.app</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffa5d7e11118" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Messenger Clone built with Flutter & Firebase]]></title>
            <link>https://indianappguy.medium.com/messenger-clone-built-with-flutter-firebase-3524fd1102b5?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/3524fd1102b5</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[chat-apps]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[chat-app-source-code]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Tue, 02 Feb 2021 13:39:51 GMT</pubDate>
            <atom:updated>2024-10-11T13:33:16.505Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gs-HNvZdVZ0515wWVBE0PA.jpeg" /></figure><p>Let’s learn how to build a chat app with flutter and firebase by building messenger clone. [Full source code]</p><p>Originally published at <a href="https://flutternerd.com/messenger-clone-built-with-flutter-firebase/">Flutternerd.com</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F2d1fslyxBjQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2d1fslyxBjQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F2d1fslyxBjQ%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/09d598bff142ef0d6cd423d23e1e1cae/href">https://medium.com/media/09d598bff142ef0d6cd423d23e1e1cae/href</a></iframe><p>If you like to learn via video then you can <a href="https://youtu.be/2d1fslyxBjQ"><strong>watch it on Youtube</strong></a><strong>, </strong>Or you can watch the demo at least, source code link in the end.</p><p>📕 Things covered in this video:</p><ol><li><a href="https://firebase.google.com/">Firebase</a> Firestore (updated 2021) create, update, read</li><li>Firestore Query &amp; Composite Query</li><li>Google Sign In with Firebase Auth &amp; Sign Out</li><li>User Login Persistence.</li><li>Save user info locally with <a href="https://pub.dev/packages/shared_preferences">shared preference</a></li></ol><p>App Features:</p><ul><li>Sign in with Google</li><li>Search user via username</li><li>Send user message real time (it’s better)</li></ul><p>Prerequisites :</p><ul><li>Install Flutter if not already <a href="https://flutter.dev/docs/get-started/install">https://flutter.dev/docs/get-started/install</a></li></ul><p><strong>Step1</strong>: Creating Flutter project &amp; Refactor Code</p><p><strong>Step2</strong>: Import required packages in pubspec.yaml</p><pre>firebase_auth:<br>  firebase_core:<br>  google_sign_in:<br>  shared_preferences:<br>  random_string:<br>  cloud_firestore:</pre><p><strong>Step3</strong>: Implemnet Sign In with Google</p><p>for this we will create a folder called services/auth.dart file</p><p>As you can see in auth.dart once the user is signed in we save user info to local database with sharedpreference so we need to create those functions.</p><p><strong>Step4</strong>: Create function to get and save data with sharedpreference. so create a folder helperfun/sharedpref_helper.dart file.</p><p><strong>Step5</strong>: Connect flutter app with firebase.</p><p><strong>Step6</strong>: Add Sha1 key to firebase project to make google sign in work properly</p><p>run this command in terminal/cmd <a href="https://stackoverflow.com/questions/15727912/sha-1-fingerprint-of-keystore-certificate">link to answer on stackoverflow</a></p><pre>keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android</pre><p>then add the sha1 key to firebase&gt; project settings &gt; Add fingerprint &gt; Save.</p><p><strong>Step7</strong>: Upload user info to firestore.</p><p>create a file in services/database.dart create a class called DatabaseMethods and add this function to it.</p><pre>addUserInfoToDB(<br>      {String userID,<br>      String email,<br>      String username,<br>      String name,<br>      String profileUrl}) {<br>    FirebaseFirestore.instance.collection(&quot;users&quot;).doc(userID).set({<br>      &quot;email&quot;: email,<br>      &quot;username&quot;: username,<br>      &quot;name&quot;: name,<br>      &quot;imgUrl&quot;: profileUrl<br>    });<br>  }</pre><p><strong>Step8</strong>: Fix multidex Issue</p><p>open android/app/build.gradle and add multidex to true (multiDexEnabled true) in default config.</p><pre>defaultConfig {<br>        // Enabling multidex support.<br>        multiDexEnabled true<br>    }</pre><p>and add the dependency.</p><pre>dependencies {<br>    implementation &#39;com.android.support:multidex:1.0.3&#39;<br>}</pre><p><strong>Step9</strong>: Implement search user by username</p><p>First we will create the user interface with a textfield, search icon &amp; back icon to cancel search.</p><p>Then we will create a firebase query function to fetch the user info from firestore where username is equal to what we are searching for.</p><pre>Future&lt;Stream&lt;QuerySnapshot&gt;&gt; getUserByUserName(String username) async {<br>    return FirebaseFirestore.instance<br>        .collection(&quot;users&quot;)<br>        .where(&quot;username&quot;, isEqualTo: username)<br>        .snapshots();<br>  }</pre><p><strong>Step10</strong>: Create Conversation screen</p><p>we will start by creating the message box.</p><p><strong>Step11</strong>: Write function to add message to firebase database.</p><p><strong>Step12</strong>: Check &amp; Create Chatroom with usernames</p><p><strong>Step13</strong>: Get and Set Messages</p><p>now since we have added messages now let’s fetch them and show in a list view with custom list item.</p><p><strong>Step14</strong>: Show list of chatrooms</p><p>Full source code: <a href="https://github.com/theindianappguy/messenger-clone-flutter">https://github.com/theindianappguy/messenger-clone-flutter</a></p><p>I hope you find this blog helpful, currently i am building MagicSlides.app which helps create <a href="https://www.magicslides.app/tools">ppt with ai</a> do check it out.</p><h3>Let’s Build More fully functioning apps with Flutter :</h3><h4>Build a Recipe App with Flutter</h4><p>Written Tutorial: <a href="https://flutternerd.com/build-a-recipe-app-with-flutter/">https://flutternerd.com/build-a-recipe-app-with-flutter</a></p><p><a href="https://youtu.be/VTR5HpRfS0A">https://youtu.be/VTR5HpRfS0A</a></p><h4>Build a Wallpaper App with Flutter From Scratch</h4><p>written tutorial: <a href="https://flutternerd.com/build-a-wallpaper-app-with-flutter-a-flutter-project/">https://flutternerd.com/build-a-wallpaper-app-with-flutter-a-flutter-project/</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEKdAU3l_0gA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEKdAU3l_0gA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEKdAU3l_0gA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2b02538ac75d72fb6c6b9f163c1b097/href">https://medium.com/media/b2b02538ac75d72fb6c6b9f163c1b097/href</a></iframe><h4>Build a Quiz Maker App with Flutter &amp; Firebase</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FixWtgO22hBE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DixWtgO22hBE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FixWtgO22hBE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/289ee59d66f258aee0ef452daee1b8f9/href">https://medium.com/media/289ee59d66f258aee0ef452daee1b8f9/href</a></iframe><h4>Build a Fully Functioning Flutter Chat App with Firebase</h4><p>written tutorial: <a href="https://flutternerd.com/build-a-fully-functioning-flutter-chat-app-with-firebase-part-1-4/">https://flutternerd.com/build-a-fully-functioning-flutter-chat-app-with-firebase-part-1-4/</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFTju8w4zEno%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFTju8w4zEno&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFTju8w4zEno%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5fa41e77cafb4ca4add5d0b7a194ff2/href">https://medium.com/media/e5fa41e77cafb4ca4add5d0b7a194ff2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3524fd1102b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Push Notification on document create Firestore]]></title>
            <link>https://medium.com/flutter-community/flutter-push-notification-on-document-create-firestore-9c1c12497cd4?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c1c12497cd4</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[firebase-cloud-functions]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Mon, 09 Nov 2020 10:02:45 GMT</pubDate>
            <atom:updated>2024-10-11T13:33:39.755Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDFFunx2Dfr4BtQqcC7E_w.jpeg" /></figure><p>Learn how to send a push notification to Android, IOS, and Flutter Web on new document creation on Firestore.</p><p>originally published @ <a href="https://flutternerd.com/flutter-push-notification-on-document-create-firestore/">flutternerd.com</a></p><p>📕 Things covered in this tutorial:</p><ul><li>Connecting Flutter App to Firebase</li><li>Sending test message from Firebase Cloud Messaging to Android device.</li><li>Adding Multidex support</li><li>Creating cloud function to listen for new document create and push notification automatically to a single device by the token.</li></ul><p>Make sure you have flutter installed if not visit <a href="https://flutter.dev/">flutter.dev</a></p><p>So let’s get started coding,</p><p><strong>Step 1</strong>: Create a flutter project, I am going to do it with Android studio you can user terminal/cmd or VS code there will be no difference.</p><p>to create project in android studio click +Start a new flutter project &gt; select flutter application &gt; provide project name and click next.</p><p><strong>Step 2</strong>: We will start by getting rid of all the comments in the main.dart and getting rid of MyHomePage() stateful widget</p><p>this helps in getting the code more clean to work with.</p><p><strong>Step 3</strong>: Create a folder/package inside the lib</p><p>we will create all the screens in this folder so I am going to name this views. then create home.dart.</p><p>just add a stateful widget called Home can call it from MyApp.</p><p><strong>Step 4</strong>: Create a new Firebase Project</p><ul><li>visit <a href="https://firebase.com/">firebase.com</a> and click “Get Started” sign in with google account</li><li>click on Go to console, + Add project</li><li>Enter project name and continue.</li><li>you can add google analytics but it’s not required.</li></ul><p>once the project is created.</p><p><strong>Step 5</strong>: Writing cloud function code we can write it in Javascript and Typescript, don’t worry if you don’t have experience with these</p><p>we will use javascript.</p><ul><li>Install <a href="https://nodejs.org/">Node.js</a> for your operating system ( i downloaded “Recommended for Most Users”)</li></ul><p><strong>Step</strong> <strong>6</strong>: Add firebase to your Android, IOS or Web app</p><p><strong>Android</strong></p><ul><li>Select the Android Icon.</li><li>Submit package name which you can find from app_folder/android/app/src/main/AndroidManifest.xml line:2</li><li>You can provide nickname not mandatory</li><li>Add SHA-1 by <a href="https://developers.google.com/android/guides/client-auth">generating SHA-1 key</a> and submit</li><li>Download the google-services.json file and add it to app_folder/android/app/</li><li>then add what’s missing to Project-level build.gradle</li></ul><pre>buildscript {<br>  repositories {<br>    // Check that you have the following line (if not, add it):<br>    google()  // Google&#39;s Maven repository<br>  }<br>  dependencies {<br>    ...<br>    // Add this line<br>    classpath &#39;com.google.gms:google-services:4.3.3&#39;<br>  }<br>}<br><br>allprojects {<br>  ...<br>  repositories {<br>    // Check that you have the following line (if not, add it):<br>    google()  // Google&#39;s Maven repository<br>    ...<br>  }<br>}</pre><ul><li>then to App-level build.gradle</li></ul><pre>apply plugin: &#39;com.android.application&#39;<br>// Add this line<br>apply plugin: &#39;com.google.gms.google-services&#39;<br><br>dependencies {<br>  // add the Firebase SDK for Google Analytics<br>  implementation &#39;com.google.firebase:firebase-analytics:17.5.0&#39;<br>  // add SDKs for any other desired Firebase products<br>  // https://firebase.google.com/docs/android/setup#available-libraries<br>}</pre><ul><li>click next and i usually click “skip this step” but you can run the app and confirm the connection.</li></ul><p><strong>Step 7</strong>: Add cloud <a href="https://pub.dev/packages/cloud_firestore">firestore package</a> &amp; <a href="https://pub.dev/packages/firebase_messaging">firebase_messaging</a> from pub.dev</p><h4>Error you may face</h4><p>Multi Index : If you find this anywhere in the error then Modify your build.gradle</p><pre>android {<br>    compileSdkVersion 22<br>    buildToolsVersion &quot;23.0.0&quot;<br><br>         defaultConfig {<br>             minSdkVersion 14 //lower than 14 doesn&#39;t support multidex<br>             targetSdkVersion 22<br><br>             // Enabling multidex support.<br>             multiDexEnabled true<br>         }<br>}<br><br>dependencies {<br>    implementation &#39;com.android.support:multidex:1.0.3&#39;<br>}</pre><p><strong>Step 8</strong>: Setting up Firestore</p><ul><li>Open firebase and select Firestore and click “Create database”</li><li>Select <strong>test mode</strong> so that we do not need to add authentication to access the database and click “Next”.</li><li>Click selecting firestore location “Done”</li></ul><p><strong>Step 9</strong>: Adding internet permission</p><p>add this code snippet to AndroidManifest.xml (app_folder/android/app/src/main/AndroidManifest.xml) within the MainActivity</p><pre>&lt;intent-filter&gt;<br>      &lt;action android:name=&quot;FLUTTER_NOTIFICATION_CLICK&quot; /&gt;<br>      &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;<br>  &lt;/intent-filter&gt;</pre><p>open app_folder/android/app/src/main/AndroidManifest.xml and add</p><pre>&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;</pre><p><strong>Step 10</strong>: Add firebase messaging dependency to Android</p><p>at &lt;app-name&gt;/android/app/build.gradle, latest version can be found <a href="https://firebase.google.com/support/release-notes/android">here</a></p><pre>com.google.firebase:firebase-messaging:20.2.4</pre><p><strong>Step 11</strong>: Setting up Firebase Messaging to Your Flutter App:</p><ul><li>Add Firebase Messaging variable and initialise.</li><li>create a initstate() and then create a function getToken();</li><li>Adding getToken() to the initi state</li><li>We also added requestNotificationPermissions for IOS</li></ul><pre>import &#39;package:firebase_messaging/firebase_messaging.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br><br>class Home extends StatefulWidget {<br>  @override<br>  _HomeState createState() =&gt; _HomeState();<br>}<br><br>class _HomeState extends State&lt;Home&gt; {<br><br>  String token = &#39;&#39;;<br>  final FirebaseMessaging firebaseMessaging = FirebaseMessaging();<br><br>  @override<br>  void initState() {<br>    getToken();<br><br>    firebaseMessaging.requestNotificationPermissions(<br>      const IosNotificationSettings(<br>        alert: true,<br>        badge: true,<br>        provisional: true,<br>        sound: true<br>      )<br>    );<br><br>    firebaseMessaging.configure(<br>      onMessage: (Map&lt;String, dynamic&gt; message) async {<br>        print(&quot;onMessage: $message&quot;);<br>        //_showItemDialog(message);<br>      },<br>      //onBackgroundMessage: myBackgroundMessageHandler,<br>      onLaunch: (Map&lt;String, dynamic&gt; message) async {<br>        print(&quot;onLaunch: $message&quot;);<br>        //_navigateToItemDetail(message);<br>      },<br>      onResume: (Map&lt;String, dynamic&gt; message) async {<br>        print(&quot;onResume: $message&quot;);<br>        //_navigateToItemDetail(message);<br>      },<br>    );<br><br>    super.initState();<br>  }<br><br>  void getToken() async {<br>    token = await firebaseMessaging.getToken();<br>  }<br><br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: Center(child: Text(&quot;Token : $token&quot;)),<br>      floatingActionButton: FloatingActionButton(onPressed: (){<br>        print(token);<br>      },<br>        child: Icon(Icons.print),<br>      ),<br>    );<br>  }<br><br>}</pre><p><strong>Step 12</strong>: Run the App &amp; Get Device token from console when clicking on floating action button.</p><p><strong>Step 13</strong>: Let’s test if it is working</p><p>Visit Firebase “Grow Section” &gt; “Cloud Messaging”</p><ul><li>Click on “Send your first message”</li><li>Enter title</li><li>Enter notification text</li><li>click on “Send test message”</li><li>submit FCM token</li><li>Now make sure the app is in background app will not receive notification if it is in foreground</li><li>click on “Test”</li></ul><p>you will receive notification on your device.</p><p><strong>Step 14</strong>: Time to write Cloud Function</p><ul><li>Visit firebase in the Developer Section click on “Functions”.</li><li>Click on Get Started</li><li>Install firebase tools by running the command as shown in the new folder after opening it in VS code.</li><li>Make sure you are logged in to firebase through the terminal run “firebase login”</li><li>then “firebase init”</li><li>Now select Functions by clicking the [Space] key then enter</li><li>select Use an existing project (remember the project we created before)</li><li>Select Javascript for Language</li><li>then to use EsLint just click enter</li></ul><p>Now the project is setting up once done, Open the index.js file and remove everything and paste as i pasted below</p><pre>const functions = require(&quot;firebase-functions&quot;);<br><br>admin.initializeApp(functions.config().firebase);<br><br>const fcm = admin.messaging();<br><br>exports.senddevices = functions.firestore<br>  .document(&quot;notification/{id}&quot;)<br>  .onCreate((snapshot) =&gt; {<br>    const name = snapshot.get(&quot;name&quot;);<br>    const subject = snapshot.get(&quot;subject&quot;);<br>    const token = snapshot.get(&quot;token&quot;);<br><br>    const payload = {<br>      notification: {<br>        title: &quot;from &quot; + name,<br>        body: &quot;subject &quot; + subject,<br>        sound: &quot;default&quot;,<br>      },<br>    };<br><br>    return fcm.sendToDevice(token, payload);<br>  });</pre><p><strong>Step 15</strong>: Let’s deploy this now</p><p>run “firebase deploy” and visit the Dashboard section in Function you will be able to see the added function</p><p><strong>Step 16</strong>: Now open Firestore in firebase</p><p>Add a new collection named “notification” as we mentioned in the cloud function and add a document with three values as we require in the cloud function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*RIi5jfX2HIaT_GTJ.jpg" /></figure><p>click save now if your app is in background you should see the notification</p><p>So finally we have successfully added Flutter Push Notification on document create Firestore 🎉.</p><p>If you have any questions? any error/problem you are facing feel free to comment them down I will get back to you as soon as possible.</p><p>I hope you find this blog helpful, currently i am building MagicSlides.app which helps create <a href="https://www.magicslides.app/tools">ppt with ai</a> do check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuT0GXEd7j21RI6uXlxYTQ.png" /><figcaption><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c1c12497cd4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/flutter-push-notification-on-document-create-firestore-9c1c12497cd4">Flutter Push Notification on document create Firestore</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Auto Deploy Flutter Web App to Firebase Hosting on every commit]]></title>
            <link>https://medium.com/flutter-community/auto-deploy-flutter-web-app-to-firebase-hosting-on-every-commit-ee0527290733?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee0527290733</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Sun, 08 Nov 2020 10:02:27 GMT</pubDate>
            <atom:updated>2024-10-11T13:34:02.368Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruFiDAyo89dRX54FZnaRLw.png" /></figure><p><strong>Summary : Deploying Flutter Web app to Github Pages on every update can be repetitive task. learn how to automate it so that whenever we will commit the latest version of our flutter web app will be deployed to Github Pages For Free by using Github Actions.</strong></p><p>originally published @ <a href="https://flutternerd.com/auto-deploy-flutter-app-to-firebase-hosting-on-every-commit/">flutternerd.com</a></p><p>In this blog post, we will learn how to automate it so that whenever we will commit the latest version of our flutter web app will be deployed to Github Pages For Free by using Github Actions.</p><h3>What is <a href="https://github.com/features/actions">Github Actions</a>?</h3><p>Github actions help us to automate our workflow be it building apk, running test, hosting our app to Github, hosting a flutter web app to firebase hosting so that we can build test and deploy right from GitHub.</p><h3>Get Started with Github Action For Flutter.</h3><p>First lets integrate Github Action to our Github Repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*HWtWyFKTYly0qEbU.png" /></figure><p>when we integrate github action all the workflows and build will be visible here.</p><p>we have to create a custom workflow to auto-deploy of flutter app to GitHub pages, so just follow step by step</p><h3>1.Creating workflow file</h3><p>first go inside your main project directory and create a folder .github this will contain all the workflow.</p><p>Now create a workflow file let’s name it deploy.yml (you can name it whatever you want), workflow file has multiple keys we will discuss each one by one.</p><h4>on:</h4><p>Github action is executed following the events under <strong>on</strong> key. In this example we want to run it only when we push to master branch, you can add any of your preferred branches</p><pre>name: Build, Release app to Github Pages and Firebase Hosting<br><br>on:<br>  push:<br>    branches:<br>      - master</pre><h4>job:</h4><p>A workflow run is made up of one or more jobs that can run sequentially or in parallel.</p><h4>runs-on:</h4><p>runs-on define the virtual machine to run the job on, for our case we need ubuntu-latest.</p><p>Each ubuntu host machine contains different set of softwares and tools you can check them <a href="https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners">here</a>.</p><pre>jobs:<br>  # This workflow contains a single job called &quot;build&quot;<br>  build:<br>    runs-on: ubuntu-latest</pre><h4>steps:</h4><p>sequence of tasks a job contain are called <strong>steps</strong>. These steps can be granular like one line command or a multiline with sequence of task pack together.</p><p>let’s go through the steps to meet our requirements.</p><ul><li>Setup Flutter environment for Github Actions for which we will use <a href="https://github.com/subosito/flutter-action">subosito/flutter-action</a></li></ul><pre>steps:<br>  - uses: actions/checkout@v1<br>  - uses: actions/setup-java@v1<br>    with:<br>      java-version: &#39;12.x&#39;<br>  - uses: subosito/flutter-action@v1<br>    with:<br>      channel: &#39;dev&#39;</pre><p>we are using dev channel.</p><ul><li>Now let’s get flutter dependencies</li></ul><pre>- name: &#39;Run flutter pub get&#39;<br>  run: flutter pub get</pre><ul><li>Let’s configure flutter web or you can say enable flutter web</li></ul><pre>- name: Enable flutter web<br>  run: flutter config --enable-web</pre><ul><li>now build web</li></ul><pre>- name: &#39;Build Web App&#39;<br>  run: flutter build web</pre><ul><li>deploy to Firebase hosting as well as github pages</li></ul><p>for this we will need two Tokens you can call then secret keys, first is “Personal access tokens” second is “Firebase Token”</p><p><strong>To get Personal access token </strong>your git profile &gt;settings&gt; Developer settings&gt; Personal Access Token&gt; Generate new token &gt; select only ‘repo’ scope and give a good name that’s it.</p><p>copy the key and go to Project &gt; Settings &gt; Secrets &gt; New Secret &gt; Enter “TOKEN” for (YOUR_SECRET_NAME) and value will be key.</p><p><strong>For getting Firebase Token</strong> run this command in the terminal in the project directory</p><pre>$ firebase login:ci</pre><p>then it will open a browser window to login select the gmail account by which you have firebase account which contains this hosting.</p><p>once done it will show your key</p><p>copy the key and go to Project &gt; Settings &gt; Secrets &gt; New Secret &gt; Enter “FIREBASE_TOKEN” for (YOUR_SECRET_NAME) and value will be key.</p><pre>- name: deploy<br>  uses: peaceiris/actions-gh-pages@v3<br>  with:<br>    github_token: ${{ secrets.TOKEN }}<br>    publish_dir: ./build/web<br>- name: Deploy to Firebase Hosting<br>  uses: w9jds/firebase-action@master<br>  with:<br>    args: deploy --only hosting<br>  env:<br>    FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}</pre><p>here is the full code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93967d8ac57e98e598ad061e30658116/href">https://medium.com/media/93967d8ac57e98e598ad061e30658116/href</a></iframe><p>If you have any question feedback you can let me know in the comments below.</p><p>I hope you find this blog helpful, currently i am building MagicSlides.app which helps create <a href="https://www.magicslides.app/tools">ppt with ai</a> do check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuT0GXEd7j21RI6uXlxYTQ.png" /><figcaption><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee0527290733" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/auto-deploy-flutter-web-app-to-firebase-hosting-on-every-commit-ee0527290733">Auto Deploy Flutter Web App to Firebase Hosting on every commit</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Payments in Flutter with Razorpay Payment Gateway]]></title>
            <link>https://medium.com/flutter-community/payments-in-flutter-with-razorpay-payment-gateway-3653bfd20052?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/3653bfd20052</guid>
            <category><![CDATA[flutter-payment]]></category>
            <category><![CDATA[flutter-package]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter-community]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Mon, 08 Jun 2020 01:46:30 GMT</pubDate>
            <atom:updated>2024-08-03T09:42:26.256Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsJ5pQNZAtE0G8PKTN3R1Q.png" /></figure><p><a href="https://youtu.be/7xcYSTH6Kx8">Integrating In-App payments in flutter</a> can be done in less than 15 minutes with Razorpay which includes Card, Netbanking, UPI and Wallet.</p><p>[It took lot’s of hours of efforts to put this for you if you find this helpful do chekout what i am building at <a href="https://www.magicslides.app/">ai presentation maker</a>, <a href="https://www.sheetai.app/">ai in google sheets</a>, <a href="https://www.magicform.app/">ai in google form</a>]</p><p>If you prefer videos here is Step by Step video on how to do the same.</p><p>Prerequisites :</p><ul><li>Install Flutter if not already <a href="https://flutter.dev/docs/get-started/install">https://flutter.dev/docs/get-started/install</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7xcYSTH6Kx8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7xcYSTH6Kx8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7xcYSTH6Kx8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2254d23113b73120345cb3e3faed2ca6/href">https://medium.com/media/2254d23113b73120345cb3e3faed2ca6/href</a></iframe><p>Okay so let’s start.</p><p><strong>Step 1</strong>: Create a Flutter Project or Use a preexisting project.</p><p>We will start by getting rid of all the comments in the main.dart and getting rid of MyHomePage() stateful widget</p><p><strong>Step 2</strong>: Add <a href="https://pub.dev/packages/razorpay_flutter">Razorpay</a> official plugin to pubspec.yaml.</p><pre>razorpay_flutter: ^1.1.4</pre><p><strong>Step 3</strong>: Create a folder/package inside the lib for the homepage, I am naming it “views”</p><p>then create a file</p><ul><li><a href="https://github.com/theindianappguy/FlutterRazorpay/blob/master/lib/views/home.dart">home.dart</a></li></ul><p>Razorpay package needs two things</p><ul><li>functions for various events (payment successful, Wallet, Error)</li><li>another function to open the payment gateway</li></ul><p>we need to provide these</p><ul><li>key</li><li>amount</li><li>name</li><li>description</li><li>prefill (like contact number and email)</li><li>external wallets</li></ul><p><strong>Step 4</strong>: Import material at home.dart and create a stateful widget called Home then create initState which is a function called when the screen loads.</p><pre><a href="http://twitter.com/override">@override</a><br>  void initState() {<br>    super.initState();</pre><pre>razorpay = new Razorpay();</pre><pre>razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, handlerPaymentSuccess);<br>    razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, handlerErrorFailure);<br>    razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, handlerExternalWallet);<br>  }</pre><p>Okay so now we need to create all these functions which we defined ( handlerPaymentSuccess, handlerErrorFailure, handlerExternalWallet)</p><p><strong>Step 5</strong>: Create handler functions</p><pre>void handlerPaymentSuccess(){<br>    print(&quot;Pament success&quot;);<br>    Toast.show(&quot;Pament success&quot;, context);<br>  }</pre><pre>void handlerErrorFailure(){<br>    print(&quot;Pament error&quot;);<br>    Toast.show(&quot;Pament error&quot;, context);<br>  }</pre><pre>void handlerExternalWallet(){<br>    print(&quot;External Wallet&quot;);<br>    Toast.show(&quot;External Wallet&quot;, context);<br>  }</pre><p><strong>Step 6</strong>: Now we will create a function to open the payment gateway and provide the required fields</p><pre>void openCheckout(){<br>    var options = {<br>      &quot;key&quot; : &quot;[YOUR_API_KEY]&quot;,<br>      &quot;amount&quot; : num.parse(textEditingController.text)*100,<br>      &quot;name&quot; : &quot;Sample App&quot;,<br>      &quot;description&quot; : &quot;Payment for the some random product&quot;,<br>      &quot;prefill&quot; : {<br>        &quot;contact&quot; : &quot;2323232323&quot;,<br>        &quot;email&quot; : &quot;<a href="/service/mailto:shdjsdh@gmail.com">shdjsdh@gmail.com</a>&quot;<br>      },<br>      &quot;external&quot; : {<br>        &quot;wallets&quot; : [&quot;paytm&quot;]<br>      }<br>    };</pre><pre>try{<br>      razorpay.open(options);</pre><pre>}catch(e){<br>      print(e.toString());<br>    }</pre><pre>}</pre><p>for the amount I have converted the text which I get from the text field through TextEdittingController to num and multiplied with 100 because by default, it will be num divided by 100 for ( values like 4.56, …).</p><p><strong>Step 7</strong>: Creating the user interface to make things easy to understand we are just going to have a text field and a button that’s all.</p><p>Here is the code that will be returned by the Widget build.</p><pre>Scaffold(<br>  appBar: AppBar(<br>    title: Text(<strong>&quot;Razor Pay Tutorial&quot;</strong>),<br>  ),<br>  body: Padding(<br>    padding: <strong>const </strong>EdgeInsets.all(30.0),<br>    child: Column(<br>      children: [<br>        TextField(<br>          controller: <strong>textEditingController</strong>,<br>          decoration: InputDecoration(<br>            hintText: <strong>&quot;amount to pay&quot;<br>          </strong>),<br>        ),<br>        SizedBox(height: 12,),<br>        RaisedButton(<br>          color: Colors.<em>blue</em>,<br>          child: Text(<strong>&quot;Donate Now&quot;</strong>, style: TextStyle(<br>            color: Colors.<em>white<br>          </em>),),<br>          onPressed: (){<br>            openCheckout();<br>          },<br>        )<br>      ],<br>    ),<br>  ),<br>);</pre><p>over here onpressed I am calling the function which we created to open the payment gateway</p><p><strong>Step 8</strong>: Get API from <a href="https://dashboard.razorpay.com/">Razorpay</a>.</p><p>visit <a href="https://dashboard.razorpay.com/">https://dashboard.razorpay.com/</a> then signup,</p><p>Once you will successfully signup, log in then you will see a dialog with two options “Activate Yout Account” and “Try out the Dashboard”.</p><ul><li>Click “Try out the Dashboard”.</li><li>Click on Generate Text Keys.</li><li>Copy the key and paste it inside the open checkout function</li></ul><p><strong>Step 9</strong>: Update the minSdkVersion to more than 19 and IOS Target and enable bitcode.</p><p><strong>Note for Android</strong>: Make sure that the minimum API level for your app is 19 or higher.</p><p><strong>Note for iOS</strong>: Make sure that the minimum deployment target for your app is iOS 10.0 or higher. Also, don’t forget to enable bitcode for your project.</p><p>Run flutter packages get in the root directory of your app.</p><p><strong>Step 10</strong>: Run the app.</p><p>Just one tip if face error, run flutter clean I faced error which was fixed by this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQNFhOolVeCzPQ2Mx85%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcheckmatedigital-code-coding-monkey-QNFhOolVeCzPQ2Mx85&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZWZkNzIwZWJiZDI3MDk0NjUzODIxZTZhNzExNTBlZDY1ZDc3NzUyMyZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FQNFhOolVeCzPQ2Mx85%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/d91fe66bda983b461cbb47fc4ce19efc/href">https://medium.com/media/d91fe66bda983b461cbb47fc4ce19efc/href</a></iframe><p>I hope this was helpful.</p><p>If it is, Show some love by claps thanks. Here is the Github Repo</p><p><a href="https://github.com/theindianappguy/FlutterRazorpay">theindianappguy/FlutterRazorpay</a></p><p>READ NEXT:</p><ul><li><a href="https://medium.com/flutter-community/build-a-wallpaper-app-with-flutter-85720dbf8e28">Build a Wallpaper App with Flutter</a>.</li><li><a href="https://medium.com/flutter-community/build-a-fully-functioning-flutter-chat-app-with-firebase-auth-and-firestore-efc98df096b0">Build a Fully Functioning Flutter Chat App with Firebase Part 1/4</a>.</li><li><a href="https://medium.com/@theindianappguy">Other</a>.</li></ul><p>WATCH NEXT:</p><ul><li><a href="https://youtu.be/VTR5HpRfS0A">Build a Recipe App with Flutter</a>.</li><li><a href="https://youtu.be/aaGcER1uUoE">Build a Flutter News App with NewsApi Org</a>.</li><li><a href="https://youtu.be/tDagLFJNXxw">Build a Quiz Maker App with Flutter &amp; Firebase</a>.</li><li><a href="https://www.youtube.com/SanskarTiwari">More</a>.</li></ul><p>Connect with Me:</p><ul><li><a href="https://www.linkedin.com/in/lamsanskar/">LinkedIn</a> | <a href="https://twitter.com/Theindianappguy">Twitter</a> | <a href="https://www.instagram.com/indianappguy/">Instagram</a> | <a href="https://www.youtube.com/SanskarTiwari">Youtube</a> | <a href="https://medium.com/@theindianappguy">Medium</a></li></ul><p><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3653bfd20052" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/payments-in-flutter-with-razorpay-payment-gateway-3653bfd20052">💵 Payments in Flutter with Razorpay Payment Gateway</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Wallpaper App with Flutter]]></title>
            <link>https://medium.com/flutter-community/build-a-wallpaper-app-with-flutter-85720dbf8e28?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/85720dbf8e28</guid>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Sun, 24 May 2020 15:12:11 GMT</pubDate>
            <atom:updated>2024-08-03T09:42:12.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ocz-yfKbsc8ZX_L62cglSg.png" /></figure><p>We are going to learn how to build a Wallpaper app with flutter and pixels API (free), so you will learn how to use API in a flutter app creating a full flutter app which is a good flutter project</p><p>[It took lot’s of hours of efforts to put this for you if you find this helpful do chekout what i am building at <a href="https://www.magicslides.app/">ai presentation maker</a>, <a href="https://www.sheetai.app/">ai in google sheets</a>, <a href="https://www.magicform.app/">ai in google form</a>]</p><p>If you like to learn via video then you can <strong>watch it on Youtube, </strong>Or you can watch the demo at least</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEKdAU3l_0gA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEKdAU3l_0gA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEKdAU3l_0gA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b00f4991f97b71b8aad0d9b11a336f1/href">https://medium.com/media/2b00f4991f97b71b8aad0d9b11a336f1/href</a></iframe><p>📕 Things covered in this video:</p><ul><li>Fetch data from an API with flutter</li><li>How useState in a flutter app</li><li>How to pass down data in a flutter widgets</li><li>How to show a grid view</li><li>Using Hero Animation</li><li>Save the image to local storage (Gallery) for both Android And IOS</li></ul><p>Prerequisites :</p><ul><li>Install Flutter if not already <a href="https://flutter.dev/docs/get-started/install">https://flutter.dev/docs/get-started/install</a></li></ul><p>Live Example <a href="https://wallpaperzone.web.app/">https://wallpaperzone.web.app/</a>, <strong>Watch App Demo on Youtube</strong> <a href="https://youtu.be/EKdAU3l_0gA">here</a></p><p>So let’s get started coding,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FzOvBKUUEERdNm%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcoding-zOvBKUUEERdNm&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExOXgwdHkxZWlqbTZmbXp1OHRuandmazRlemIzaGh1djFiNmkwMGsweiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FzOvBKUUEERdNm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6a57a70a87599fcd4c6c2cccd289fb8/href">https://medium.com/media/d6a57a70a87599fcd4c6c2cccd289fb8/href</a></iframe><p><strong>Step 1:</strong> Get Pexels API Key (FREE)</p><p>visit <a href="http://pexels.com/api">http://pexels.com/api</a> and signup then click on request access and you will get Your API Key</p><p><strong>Step 2</strong>: Create flutter projects</p><p>I did it with terminal, you can also create with Android Studio/Visual Studio or cmd, there will be no difference</p><p><strong>Step 3</strong>: We will start by getting rid of all the comments in the main.dart and getting rid of MyHomePage() stateful widget</p><p><strong>Step 4</strong>: Create a folder/package inside the lib we will create all the screens in this folder so I am going to name this “<em>views”</em>.</p><p>then create a file for every screen</p><ul><li><a href="https://github.com/theindianappguy/wallpaperhub/blob/master/lib/home.dart">home.dart</a></li><li><a href="https://github.com/theindianappguy/wallpaperhub/blob/master/lib/view/categorie_screen.dart">categorie.dart</a></li><li><a href="https://github.com/theindianappguy/wallpaperhub/blob/master/lib/view/search_view.dart">search.dart</a></li><li>image_view.dart</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MdJpwLroQzqgC_517MEtRw.png" /></figure><p><strong>Step 5</strong>: Building Home Page</p><ul><li>Import material in home.dart</li><li>create a stateful widget (use shortcut write stf and hit enter) called Home.</li><li>now _HomeState class will be returning container change it with scaffold so that we can use all the out of box material widget-like app bar, body, floating action button, and more.</li><li>create a package/folder called widgets then create widgets.dart file</li></ul><p>since all the screen will have the same app bar title we will create it once in widgets.dart and use it everywhere</p><p>so add this in widgets.dart</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f7ad7b3c345a13a8c31a6084a1b70d6/href">https://medium.com/media/8f7ad7b3c345a13a8c31a6084a1b70d6/href</a></iframe><p>in this, we basically have arranged two widgets horizontally ( better option to do this can be <a href="https://api.flutter.dev/flutter/widgets/RichText-class.html">richtext</a>) and we also provided some styling to each</p><p>now make sure to update the home: in main.dart to Home().</p><p>now add this appBar in home.dart</p><pre>appBar: AppBar(<br>        title: brandName(),<br>        elevation: 0.0,<br>      ),</pre><p>now let’s work on creating the search bar,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*raGr9jeOmln2TBYNMMc1YQ.png" /></figure><p>The search bar is simply horizontal arrangement of widgets which is a text field(used to get user input) and icon</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c0b1d6774efa8f9d1447e063c5cd1c1/href">https://medium.com/media/9c0b1d6774efa8f9d1447e063c5cd1c1/href</a></iframe><p>Now let’s create the <strong>categories option</strong>, which is a horizontal list view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Zki-Touw-M3pLfcItVC22A.png" /></figure><p>For this we will create a new file where we will save these categories locally with their imageUrl;</p><p>so create a new package/folder inside lib name it data and create data.dart file inside it</p><p>Now since we want to save a list of different variables be it the category name, imageUrl, so we will create a new model so create a model package/folder inside lib and create categories.model</p><pre>class CategorieModel {<br>  String categorieName;<br>  String imgUrl;<br>}</pre><p>okay now inside the data.dart file we will create a function getCategories() which will return List&lt;CategorieModel&gt;</p><p>here is the code, I have also added the string apiKey add your API key here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/018e6d8f0d914fa437706257ae884922/href">https://medium.com/media/018e6d8f0d914fa437706257ae884922/href</a></iframe><p>now we have the data now lets work on creating the list item then getting the data to home.dart and show it in a listview</p><p>For the list item, I call it CateogorieTile which accepts two string which is categorie(name), and imageUrl.</p><p>since the UI is that the text is above the image we will use stack and then provide styling here is the code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7e913ee7872ccfab7967809f8bb6859/href">https://medium.com/media/b7e913ee7872ccfab7967809f8bb6859/href</a></iframe><p>now to get data from data.dart inside initState() method.</p><p>So first create a variable inside _HomeState</p><pre>List&lt;CategorieModel&gt; categories = new List();</pre><p>then add this.</p><pre>@override<br>  void initState() {<br>    categories = getCategories();<br>    super.initState();<br>  }</pre><p>it will show error since getCategories() is in data.dart so import by clicking on the bulb icon</p><p>now let&#39;s create the List after the search also to add little vertical spacing between the list and the search use SizedBox(height:8)</p><p>then add this,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99f4cff479a7de4ef43503a352ecbe25/href">https://medium.com/media/99f4cff479a7de4ef43503a352ecbe25/href</a></iframe><p>and run the app either on android or IOS…</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FsSmxfWnEVxtWU%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FsSmxfWnEVxtWU&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExNnE2NXU2dXN4eW04NWxheDBiZXQ3M3Ricjc3cWYzamUzaXlxY2E2ZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FsSmxfWnEVxtWU%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="239" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e40ebad034872a1191b319378506653/href">https://medium.com/media/1e40ebad034872a1191b319378506653/href</a></iframe><p>Running? 👍, if not comment on this <a href="https://www.youtube.com/watch?v=EKdAU3l_0gA">video</a> I will reply</p><blockquote>Now Let’s fetch the data from the Pexels API</blockquote><p>So pexels have two API for images,</p><ul><li>search image with a query</li><li>other is curated images API which updates regularly and is the same as what can be seen on pexels homepage.</li></ul><p>okay so let’s create that function and add above the initState().</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/535d8a1acd408c4e08c4e9f9b53d22ee/href">https://medium.com/media/535d8a1acd408c4e08c4e9f9b53d22ee/href</a></iframe><p>✋ some things to clear <strong>async, await, Map,http</strong> I have also created one more model called Photos Model</p><p>First, this is what API is returning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ly585Kg6W1822s7pbDnvQ.png" /><figcaption>Screenshot from Postman</figcaption></figure><p>So this is what we are getting, this is actually Map with a list of Map of Photos, What is Map? The map is a collection of key-value pairs and {…..} represents a map while [] represents a list</p><ul><li>First, add <a href="https://pub.dev/packages/http">http</a> in pubspec.yaml file like this</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*6q3ymsRUc4n-v91AYJlOFw.png" /></figure><p>import it in home.dart</p><pre>import &#39;package:http/http.dart&#39; as http;</pre><ul><li>Create photos_model.dart inside models package/folder</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fe17f26281b08ac627f32ecd65b651c/href">https://medium.com/media/5fe17f26281b08ac627f32ecd65b651c/href</a></iframe><p>so PhotosModel contains a PhotoModel.fromMap() which can accept Map and return PhotoModel</p><p>🤔 Now what about await and async think of it this way when we will request the data it will take some time for it to fetch that if we get the value before we have received it will always be null right so await means we will wait for it to complete then only we will continue</p><p>Okay so now we are getting the curated list of wallpaper now is the time to show it in the list view</p><p>here is how.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58d658884ebccee0e203e5bbd8d8c713/href">https://medium.com/media/58d658884ebccee0e203e5bbd8d8c713/href</a></iframe><p>add this to <a href="https://github.com/theindianappguy/wallpaperhub/blob/master/lib/widget/widget.dart">widget.dart</a> and then add this to <a href="https://github.com/theindianappguy/wallpaperhub/blob/master/lib/home.dart">home.dart</a>, the reason why we add it in the widget.dart rather than directly in home.dart because we will be using this in all the screens.</p><pre>wallpapersList(wallpapers: <strong>wallpapers</strong>, context: context)</pre><p>so home.dart is done.</p><p><strong>Step 6</strong>: Building Search Page</p><p>open <a href="https://github.com/theindianappguy/wallpaperhub/blob/master/lib/view/search_view.dart">search.dart</a> file and create a new stateful widget called Search, why stateful? because to get the data we will be calling the function in the init state.</p><p>Now open home.dart and wrap the search icon with GestureDetector and use ontap() to send the user to Search</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11c472294c4eaedd624f3f8db2e66011/href">https://medium.com/media/11c472294c4eaedd624f3f8db2e66011/href</a></iframe><p>to pass the query from home.dart to search.dart for this first we will create a TextEdittingController, why? basically we can assign text editing controller to the TextField and can get the user input</p><pre>TextEditingController searchController = new TextEditingController();</pre><p>now to make the Search stateful widget in search.dart to accept this variable we will create variable and constructor</p><p>Ok, so now we are in the search screen</p><ul><li>First, to add app bar we will first return Scaffold() in the _SearchState class and add appBar</li></ul><pre>appBar: AppBar(<br>        title: brandName(),<br>        elevation: 0.0,<br>),</pre><ul><li>Now let’s create the body</li></ul><p>for the body, we will First Use container which has column as a child the reason for using a container is we can provide padding and margin if required not a must.</p><p>then we will copy-paste the same search here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ABU2pcCsRM0OUiA0_7t4kw.png" /></figure><p>Similar to what used at home.dart,</p><p>The search bar is simply horizontal arrangement of widgets which is a text field(used to get user input) and icon</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c0b1d6774efa8f9d1447e063c5cd1c1/href">https://medium.com/media/9c0b1d6774efa8f9d1447e063c5cd1c1/href</a></iframe><p>now what we want is to get image from pexels by query</p><p>here is the function</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89926fbb0e44d33fe086ad73bf6f1007/href">https://medium.com/media/89926fbb0e44d33fe086ad73bf6f1007/href</a></iframe><p>just import apiKey ( which is in the data.dart file), now we will call this function in the initState() So that we can get the wallpapers when this screen opens and we will pass the string we get.</p><pre>@override  void initState() {    <br> getSearchWallpaper(widget.search);    <br> searchController.text = widget.search;    <br> super.initState();  <br>}</pre><p>also, add TextEdittingController as we did in the home.dart and I am providing it the value we get from the home.dart so that the text in the text field is shown</p><p>now we also want this to work when a user enters something in the text field and search rather than send as we did in the home.dart we will just call getSearchWallpaper(searchController.text)</p><p>Now let&#39;s add the Wallpaper Gridview like this</p><pre>wallPaper(photos, context),</pre><p>full source of search.dart can be found <a href="https://github.com/theindianappguy/wallpaperhub/blob/master/lib/view/search_view.dart">here</a></p><p><strong>Step 7</strong>: Building Category Page</p><p>This is the same as search but without searchBar 😉, we want to open this when someone clicks on the categories at home.dart so</p><p>we will send the category name from the categoriesTile wrapping the container in the GestureDetector and using onTap()</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e07753b8a30cb9a141a151c3e3a7515/href">https://medium.com/media/1e07753b8a30cb9a141a151c3e3a7515/href</a></iframe><p>Now what we want is when someone will click on the image we should show that in full screen. with a button to save the image to local storage so that they can use it as wallpaper</p><p><strong>Step 8</strong>: Building Image View Screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*PV5PwMLhUvqDxxwVuw4idA.png" /></figure><ul><li>import material.</li><li>Create a stateful widget called ImageView and return Scaffold.</li></ul><p>so basically in this, we will accept the imageUrl and show it in full screen also you can notice we have a button which is actually a container with a column as a child having two text widgets</p><p>also, the container is wrapped inside a column which also consists of a test widget which is “Cancel”</p><p>Now since we want the button to be above the image we will use stack here is the code for <a href="https://github.com/theindianappguy/wallpaperhub/edit/master/lib/view/image_view.dart">image_view.dart</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b00b37dc0da4096eba484a34a11b8f1/href">https://medium.com/media/3b00b37dc0da4096eba484a34a11b8f1/href</a></iframe><p>you can notice we have wrapped the button with InkWell and in the onTap() we are checking if it is web or other if web we are open the URL in a new tab so that person can do “save image as” else we call a function to save the image to the gallery</p><p>for which add these in the pubspec.yaml</p><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  <strong>http: ^0.12.0+4</strong><br>  cached_network_image: ^2.0.0<br>  image_gallery_saver: ^1.2.2<br>  permission_handler: ^4.2.0+hotfix.3<br>  random_string: ^2.0.1<br>  dio: ^3.0.9<br>  url_launcher: ^5.4.2<br>  url_launcher_web: ^0.1.1+1</pre><p>we already have imported the http let’s see why others</p><ul><li>the cached network helps in caching the image so that less internet is consumed and overall better user experience for the user</li><li>image_gallaery_saver is used to save the image to the gallery</li><li>permission handler is used to handle permission</li><li>random_string for image name</li><li>dio is used for saving image function</li><li>URL launcher to launch URL</li></ul><p>now run 🎉 congratulations now you have an app which you can add to your resume 😉</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F9VrNAJYptox5nKGXmr%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Feuronews-9VrNAJYptox5nKGXmr&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F9VrNAJYptox5nKGXmr%2Fgiphy-downsized-large.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/68382376cf7f05978946dcb762cb8702/href">https://medium.com/media/68382376cf7f05978946dcb762cb8702/href</a></iframe><p>If you find this helpful then Make sure to give 50 claps 😀 it will really motivate me to share more.</p><p><strong>Full App Source Code</strong> :</p><p><a href="https://github.com/theindianappguy/wallpaperhub">theindianappguy/wallpaperhub</a></p><p>🎓More tutorials you may like</p><ul><li><strong>Build a Fully Functioning Flutter Chat App with Firebase</strong>: <a href="https://www.youtube.com/watch?v=FTju8w4zEno">https://www.youtube.com/watch?v=FTju8w4zEno</a></li><li><strong>Build a Recipe App with Flutter</strong>: <a href="https://youtu.be/VTR5HpRfS0A">https://youtu.be/VTR5HpRfS0A</a></li><li><strong>Build a Flutter News App with NewsApi Org</strong>: <a href="https://youtu.be/aaGcER1uUoE">https://youtu.be/aaGcER1uUoE</a></li><li><strong>How to Save Data from Flutter App to Google Sheets</strong>: <a href="https://youtu.be/x2CoecrzBCA">https://youtu.be/x2CoecrzBCA</a></li></ul><figure><a href="https://www.youtube.com/channel/UCsPdgUIoOBTBI1UmulW1pdw/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGmO6G_SNAAJ_SiyHVMlMQ.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85720dbf8e28" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/build-a-wallpaper-app-with-flutter-85720dbf8e28">Build a Wallpaper App with Flutter</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Fully Functioning Flutter Chat App with Firebase]]></title>
            <link>https://medium.com/flutter-community/build-a-fully-functioning-flutter-chat-app-with-firebase-auth-and-firestore-efc98df096b0?source=rss-ae50a8b1352------2</link>
            <guid isPermaLink="false">https://medium.com/p/efc98df096b0</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[chat-app-development]]></category>
            <category><![CDATA[firebaseauthentication]]></category>
            <dc:creator><![CDATA[Sanskar Tiwari]]></dc:creator>
            <pubDate>Sat, 16 May 2020 10:01:01 GMT</pubDate>
            <atom:updated>2024-08-03T09:41:51.573Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a Fully Functioning Flutter Chat App with Firebase Part 1/4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HTdqsZ3dYSROhPgBBOTSNA.png" /></figure><p>In this series you will learn how to create a fully functioning chat app with flutter &amp; Firebase, we will be using Firebase Auth, Firebase Firestore, Shared Preference to keep the user logged in, and much more.</p><p>[It took lot’s of hours of efforts to put this for you if you find this helpful do chekout what i am building at <a href="https://www.magicslides.app/">ai presentation maker</a>, <a href="https://www.sheetai.app/">ai in google sheets</a>, <a href="https://www.magicform.app/">ai in google form</a>]</p><p>Chat is something many apps now require if not even creating a stand-alone chat app, If you like to learn via video then you can <strong>watch it on Youtube</strong></p><p>🎬 Full PlayList: <a href="https://bit.ly/chatappwithflutter">https://bit.ly/chatappwithflutter</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFTju8w4zEno%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFTju8w4zEno&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFTju8w4zEno%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4819334180fbec241096253fbb4ee07b/href">https://medium.com/media/4819334180fbec241096253fbb4ee07b/href</a></iframe><p>📕 Things covered in this Series:</p><ul><li><strong>Firebase Auth</strong>: Sign in, Sign up and Sign out</li><li><strong>Firebase Firestore</strong>: Upload &amp; Retrieve data stored in Cloud Firestore</li><li>Perform simple and compound queries in Cloud Firestore</li><li>Building Complexe UI</li><li><strong>Shared Preference</strong> to keep the user logged in, Create chat room ( with username) &amp; Send message ( by username)</li><li>Using <strong>Stream</strong> &amp; <strong>Stream builder</strong></li></ul><p>Prerequisites :</p><ul><li>Install Flutter if not already <a href="https://flutter.dev/docs/get-started/install">https://flutter.dev/docs/get-started/install</a></li></ul><p>Make Sure :</p><ul><li>I have also linked to a specific time in Youtube for steps and linked so if you face any problem you can always watch that part in the video</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLG2gMrQ-5cxuJ-rsX7dxA.png" /></figure><p>Live Example: <a href="https://flutterdevconnect.web.app/">https://flutterdevconnect.web.app/</a> ( with some additional features), <strong>Watch App Demo on Youtube</strong> <a href="https://youtu.be/FTju8w4zEno?t=15">here</a></p><p>So let’s get started coding,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FPiQejEf31116URju4V%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmemecandy-PiQejEf31116URju4V&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FPiQejEf31116URju4V%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="261" frameborder="0" scrolling="no"><a href="https://medium.com/media/72770ddb757e68934b899ae3fa96f986/href">https://medium.com/media/72770ddb757e68934b899ae3fa96f986/href</a></iframe><p><strong>Step 1</strong>: Create a flutter project, I am going to do it with Android studio you can user terminal/cmd or VS code there will be no difference.</p><p><strong>Step 2</strong>: We will start by getting rid of all the comments in the main.dart and getting rid of MyHomePage() stateful widget</p><p><strong>Step 3</strong>: Create a folder/package inside the lib we will create all the screens in this folder so I am going to name this views.</p><p>then create a file for every screen</p><ul><li>signin.dart</li><li>signup.dart</li><li>forgetpassword.dart</li><li>chatroomscreen.dart</li></ul><p><strong>Step 4</strong>: First we will create a widget called SignIn inside signin.dart where we will use scaffold, appBar, body and floating action button</p><p>so since the appBar is going to be very similar for most of the screen I am going to create it in a separate file so that it can be used in other screens as well</p><p>So I will create a new folder/package name widgets and create <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/blob/master/lib/widget/widget.dart">widgets.dart </a>inside it. and will create appBar</p><pre>import &#39;package:flutter/material.dart&#39;;</pre><pre>Widget appBarMain(BuildContext context) {<br>  return AppBar(<br>    title: Image.asset(<br>      &quot;assets/images/logo.png&quot;,<br>      height: 40,<br>    ),<br>    elevation: 0.0,<br>    centerTitle: false,<br>  );<br>}</pre><p>as you can see for the title we are using an image asset which you can get from <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/blob/master/assets/images/logo.png"><strong>here</strong></a> download it ( image may not be visible being white, with GitHub white background)</p><p>then create an assets folder inside the main directory also create image folder inside of it then to use add this to <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/blob/master/pubspec.yaml">pubspec.yaml</a></p><pre>assets:    <br>  - assets/images/</pre><p>after adding this click on packages get for android studio, save for VS code</p><p>now according to the design we have a dark background for this just go to <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/blob/master/lib/main.dart">main.dart</a> and inside themedata add</p><pre>scaffoldBackgroundColor: Color(0xff1F1F1F),</pre><p><strong>Step 5</strong>: Creating the UI of SignIn &amp; SignUp Screen</p><p>UI in flutter is about understanding the arrangement of widgets by widgets I mean everything, it can be text, image, button …</p><p>We use column and row to structure widgets in vertical and horizontal manner respectively</p><p>Creating a text input box we use TextField and for the button, I am creating that Using container</p><p>here is how it looks.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7adf90fbd9e34e1bdf9f0776f1925898/href">https://medium.com/media/7adf90fbd9e34e1bdf9f0776f1925898/href</a></iframe><p>It will show a bunch of errors let’s fix them</p><ul><li>appBarMain() : we need to import this so just select it and click on bulb and import.</li><li>simpleTextStyle() : Since the text style for text field is same and it will be use more than 5 times 2 times in sign in 3 times in signup i will be creating it in <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/blob/master/lib/widget/widget.dart">widgets.dart</a></li></ul><pre>TextStyle simpleTextStyle() {  <br>  return TextStyle(color: Colors.white, fontSize: 16);<br>}</pre><ul><li>textFieldInputDecoration() : Similar to simpleTextStyle create this inside widgets.dart</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61bde45691657e47e4264c6cd3a1b6cb/href">https://medium.com/media/61bde45691657e47e4264c6cd3a1b6cb/href</a></iframe><ul><li>biggerTextStyle() : Similar to simpleTextStyle just to have bigger font size</li></ul><pre>TextStyle biggerTextStyle() {  <br>  return TextStyle(color: Colors.white, fontSize: 17);<br>}</pre><ul><li>CustomTheme.textColor : I created a helper folder/package and then <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/edit/master/lib/helper/theme.dart">theme.dart</a> and there i added the textColor and ColorAccent</li></ul><p><strong>SignUp</strong> can be created just by pasting same code with one textfield extra for username and changing the text from SignIn to SignUp and also import the styles which we created before</p><p><strong>Step 6</strong> : Connecting Flutter app with Firebase</p><ul><li><a href="https://youtu.be/FTju8w4zEno?t=2564">Connecting Android to Firebase</a> :</li></ul><ol><li>Login to the <a href="https://firebase.com/"><strong>Firebase</strong></a> ( or signup with google account)</li></ol><p>create a project and then &gt; Project Overview then enter the “Package Name” for this project it is com.theindianappguy.chat_app_tutorial</p><p>to get the package name of your project open android &gt; app &gt; build.gradle inside theme <strong>scroll down and you will find</strong></p><pre>defaultConfig {<br>  ....<br>  applicationId &quot;com.example.chatapp&quot;    <br>  ....   <br>}</pre><p>2. Download google-services.json and move the google-services,json file you just downloaded into your Android app module root directory (<strong>app</strong> folder)</p><p>3. Add google-services dependencies in Project-level build.gradle</p><pre>dependencies {  <br>  ...        <br>  classpath &#39;com.google.gms:google-services:4.3.3&#39; <br>  ...      <br>}</pre><p>That’s it 🙂 Connecting android app to firebase is done</p><ul><li><a href="https://youtu.be/FTju8w4zEno?t=2902">Connecting IOS to Firebase</a> :</li></ul><ol><li>Right-click on ios folder and “click open with Xcode” [Only for Mac blame apple 😕]</li></ol><p>then there click on main Runner(blue document) then copy the ios Bundle identifier</p><p>2. In Firebase console click on ios icon then submit iOS bundle ID and click “Register app”</p><p>3. Download GoogleService-Info.plist and then move the GoogleService-Info.plist file you just downloaded into the root of your Xcode project and it to all targets</p><p>That’s it 🙂 Connecting iOS app to firebase is done</p><p>Okay so let’s continue to next steps, So far we have built a beautiful sign in screen with flutter now its time to make functioning</p><p>Now to implement Firebase Auth first we will work on SignUp screen and then SignIn Screen. also rather than calling SignIn() from main.dart call SignUp() in home.</p><p><strong>Step 7</strong> : Create TextEditingController</p><p>why? we have actually created the textfield which will accept user input but to get userinput of what he have written we can use onchanged property which updates everytime (every time) he (user) write or we can just use a texteditting controller</p><pre>TextEditingController emailEditingController = new TextEditingController();</pre><pre>TextEditingController passwordEditingController = new TextEditingController();</pre><pre>TextEditingController usernameEditingController = new TextEditingController();</pre><p>then assign these controller to the textfields like this for username, email &amp; password</p><pre>TextFormField(<br>  ...<br>  controller: emailEditingController,<br>  ...</pre><pre> ),</pre><p>If it feel confusing check out the final <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/edit/master/lib/views/signup.dart">signup.dart</a></p><p><strong>Step 8: </strong><a href="https://youtu.be/FTju8w4zEno?t=3117">Creating Functions for Sign In, SignUp, LogOut Flutter Firebase</a></p><p>since we want to use firebase auth, go to Firebase and click on “Authentication” the click on set up sign-in method and then enable Email/Password</p><ol><li>Add firebase_auth to pubspec.yaml</li></ol><pre><strong>firebase_auth: ^0.16.0</strong></pre><p>2. Create auth.dart</p><p>create a folder called services inside lib and then create auth.dart file inside it</p><p>[learn how we create these function through video <a href="https://youtu.be/FTju8w4zEno?t=3157"><strong>here</strong></a>]</p><ul><li>Create AuthService class</li></ul><pre>class AuthService {</pre><pre>}</pre><ul><li>Instantiate FirebaseAuth</li></ul><pre>final FirebaseAuth _auth = FirebaseAuth.instance;</pre><ul><li>Create signInWithEmailAndPassword() function</li></ul><pre>Future signUpWithEmailAndPassword(String email, String password) async {<br>    try {<br>      AuthResult result = await _auth.createUserWithEmailAndPassword(<br>          email: email, password: password);<br>      FirebaseUser user = result.user;<br>      return _userFromFirebaseUser(user);<br>    } catch (e) {<br>      print(e.toString());<br>      return null;<br>    }<br>  }</pre><ul><li>create signUpWithEmailAndPassword() function</li></ul><pre>Future signUpWithEmailAndPassword(String email, String password) async {<br>    try {<br>      AuthResult result = await _auth.createUserWithEmailAndPassword(<br>          email: email, password: password);<br>      FirebaseUser user = result.user;<br>      return _userFromFirebaseUser(user);<br>    } catch (e) {<br>      print(e.toString());<br>      return null;<br>    }<br>  }</pre><ul><li>create resetPass() function</li></ul><pre>Future resetPass(String email) async {<br>    try {<br>      return await _auth.sendPasswordResetEmail(email: email);<br>    } catch (e) {<br>      print(e.toString());<br>      return null;<br>    }<br>  }</pre><ul><li>create signOut() function</li></ul><pre>Future signOut() async {<br>    try {<br>      return await _auth.signOut();<br>    } catch (e) {<br>      print(e.toString());<br>      return null;<br>    }<br>  }</pre><p>find full code <a href="https://github.com/theindianappguy/FlutterChatAppTutorial/blob/master/lib/services/auth.dart"><strong>here</strong></a></p><p><strong>Step 9</strong> : Implement Sign In Functionality</p><p>so when user inputs the info we will call the function and sign him up but lets say he did not enter anything 🤔 then we don’t want to call the function that’s just not required server calls</p><p>So first we will implement validation basically we will be testing the user input like is it empty for username, is it email and for password is it less than 6 character</p><p>for this we need to use <a href="https://api.flutter.dev/flutter/material/TextFormField-class.html">TextFormField</a> so just add update TextField to TextFormField and then</p><p>Wrap all the TextFormField in a column and that column will be wrapped in Form like this (… represents something)</p><pre>Form(<br> child : Column(<br>   children:[<br>     TextFormField(<br>       ...<br>     ),<br>    TextFormField(<br>       ...<br>     ),<br>    TextFormField(<br>       ...<br>     ),<br>  ])<br>)</pre><p>now to validate we need formkey so let’s create that</p><pre>final formKey = GlobalKey&lt;FormState&gt;();</pre><p><strong>Now let’s add validation in TextFormField</strong></p><ul><li>for username</li></ul><p>so we created a function which accepts val as argument which is what user inputs now when check if val is empty and accordingly we run conditional statement which works like this</p><p>CONDITION ? TRUE (DO THIS): FALSE (DO THIS)</p><pre>TextFormField(<br>   <strong>validator: (val){<br>     return val.isEmpty || val.length &lt; 3 ? &quot;Enter Username 3+      characters&quot; : null;<br>   },</strong><br>),</pre><ul><li>for email</li></ul><p>for email its little complex to see for first time</p><p>this is called regular expression we check if the provided string is like email or not if true then we return null if false it will show error.</p><pre>TextFormField(<br>   <strong>validator: (val){<br>     return RegExp(r&quot;^[a-zA-Z0-9.a-zA-Z0-9.!#$%&amp;&#39;*+-/=?^_`{|}~]+@[a-      zA-Z0-9]+\.[a-zA-Z]+&quot;).hasMatch(val) ? null : &quot;Enter correct email&quot;;<br>   },</strong><br>),</pre><ul><li>for password</li></ul><p>for password we just want to make sure it is more than 6 characters and also add obscrure text so that the password will be hidden</p><pre>TextFormField(<br>  <strong> obscureText: true,<br>   validator:  (val){<br>     return val.length &lt; 6 ? &quot;Enter Password 6+ characters&quot; : null;<br>   },</strong><br>),</pre><p>okay so now we want that when user will click on the Sign Up button first we should show user something is happening like a circular progress bar</p><p>then we will call the function we created in the auth.dart file and provide the username, emaill and password to signup and then send the user to the home screen.</p><p>So lets do that, first create a bool (boolean value true/false) called isLoading which will be initially false</p><pre>bool isLoading = false;</pre><p>also add this to call functions in auth.dart</p><pre>AuthService authService = new AuthService();</pre><p>now lets create the signUp function inside signup.dart</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/916bbbd538da5a9a31a6218634f30673/href">https://medium.com/media/916bbbd538da5a9a31a6218634f30673/href</a></iframe><p>😨 too much code…</p><p>let’s understand what happened, first we did a if condition so that the upcoming statement will only run if its true</p><p>formKey.currentState.Validate() runs all the onvalidate and if they all are null then returns true or else false and TextFormField will show error</p><p>then we are setting isLoading = true;</p><p>what is setSatate((){})?</p><p>well when update some value and we want that to change the UI then calling setstate() recreates the whole ui with updates data</p><p>then we are calling the function in auth.dart to signup the user, which will return the userid, so we will check if the result is null or not</p><p>if result != null then we will send the user to the ChatRoom() screen,</p><p>Now to show loading according to isLoading bool we need to update some code</p><pre>body : isLoading ? Container(child: Center(child: CircularProgressIndicator(),),) : </pre><pre>Container(<br>   ...all code....<br>)</pre><p>so what now, now to call this signUp() function when user click on the signup button we will wrap the button with GestureDetector and call signUp() onTap:, like this</p><pre>GestureDetector(<br>  onTap: (){<br>   singUp();<br>  },<br>  child: Container(<br>    ...sign up button...<br>  )<br>)</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F8YBm95B5JNIXTWp5on%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcheckmatedigital-trending-monkey-business-working-hard-8YBm95B5JNIXTWp5on&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F8YBm95B5JNIXTWp5on%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/62255459028876e55c8049efda761418/href">https://medium.com/media/62255459028876e55c8049efda761418/href</a></iframe><p>I think that’s enough for the Part 1 we will continue with Part 2</p><h3>☑️ Repository:</h3><p>Here’s GitHub repo which is complete Chat app made with Flutter and Firebase : <a href="https://github.com/theindianappguy/FlutterChatAppTutorial">https://github.com/theindianappguy/FlutterChatAppTutorial</a></p><p>If you found this project useful, then please consider giving it a ⭐️ on GitHub and sharing it with your friends via social media.</p><figure><a href="https://www.youtube.com/c/SanskarTiwari"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGmO6G_SNAAJ_SiyHVMlMQ.png" /></a></figure><p><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efc98df096b0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/build-a-fully-functioning-flutter-chat-app-with-firebase-auth-and-firestore-efc98df096b0">Build a Fully Functioning Flutter Chat App with Firebase</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>