<?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 Riya Tyagi on Medium]]></title>
        <description><![CDATA[Stories by Riya Tyagi on Medium]]></description>
        <link>https://medium.com/@tyagi.riyaa2022?source=rss-c80865a2a129------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5OZ0TRwYGYDcbseJamV2ig.jpeg</url>
            <title>Stories by Riya Tyagi on Medium</title>
            <link>https://medium.com/@tyagi.riyaa2022?source=rss-c80865a2a129------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 14:38:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tyagi.riyaa2022/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[These are some of the blogs I have written for Scaler Academy.]]></title>
            <link>https://medium.com/@tyagi.riyaa2022/these-are-some-of-the-blogs-i-have-written-for-scaler-academy-df5a3587edf7?source=rss-c80865a2a129------2</link>
            <guid isPermaLink="false">https://medium.com/p/df5a3587edf7</guid>
            <dc:creator><![CDATA[Riya Tyagi]]></dc:creator>
            <pubDate>Fri, 09 Feb 2024 12:27:29 GMT</pubDate>
            <atom:updated>2024-02-09T12:27:29.594Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Flutter AppBar </strong>— <a href="https://www.scaler.com/topics/flutter-appbar/">https://www.scaler.com/topics/flutter-appbar/</a></p><p><strong>Dropdown</strong> — <a href="https://www.scaler.com/topics/flutter-dropdown/">https://www.scaler.com/topics/flutter-dropdown/</a></p><p><strong>TextField — </strong><a href="https://www.scaler.com/topics/flutter-textfieldtitle/">https://www.scaler.com/topics/flutter-textfieldtitle/</a></p><p><strong>Database</strong> — <a href="https://www.scaler.com/topics/flutter-tutorial/flutter-database/">https://www.scaler.com/topics/flutter-tutorial/flutter-database/</a></p><p><strong>Google Maps</strong> — <a href="https://www.scaler.com/topics/flutter-google-maps/">https://www.scaler.com/topics/flutter-google-maps/</a></p><p><strong>DeepLink</strong> — <a href="https://www.scaler.com/topics/deeplink-flutter/">https://www.scaler.com/topics/deeplink-flutter/</a></p><p><strong>SnackBar</strong> — <a href="https://www.scaler.com/topics/snackbar-flutter/">https://www.scaler.com/topics/snackbar-flutter/</a></p><p><strong>Flutter developer skills</strong> — <a href="https://www.scaler.com/topics/flutter-developer-skills/">https://www.scaler.com/topics/flutter-developer-skills/</a></p><p><strong>QR code scanner </strong>— <a href="https://www.scaler.com/topics/qr-code-scanner-flutter/">https://www.scaler.com/topics/qr-code-scanner-flutter/</a></p><p><strong>Styling widgets in Flutter </strong>— <a href="https://www.scaler.com/topics/flutter-tutorial/styling-flutter-widgets/">https://www.scaler.com/topics/flutter-tutorial/styling-flutter-widgets/</a></p><p><strong>Razorpay in Flutter </strong>— <a href="https://www.scaler.com/topics/razor-pay-flutter/">https://www.scaler.com/topics/razor-pay-flutter/</a></p><p>Please read, learn , enjoy and comment.</p><p>Don’t forget to connect with me.</p><p>LinkedIn- <a href="https://www.linkedin.com/in/riya-tyagi-5b42a313a/">https://www.linkedin.com/in/riya-tyagi-5b42a313a/</a></p><p>Github — <a href="https://github.com/riyatyagi99">https://github.com/riyatyagi99</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df5a3587edf7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Maps in Flutter]]></title>
            <link>https://medium.com/@tyagi.riyaa2022/google-maps-in-flutter-5f1deb990e0d?source=rss-c80865a2a129------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f1deb990e0d</guid>
            <dc:creator><![CDATA[Riya Tyagi]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 10:48:39 GMT</pubDate>
            <atom:updated>2023-05-23T06:54:10.652Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F19658644&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fshuru-karte-hain-shuru-karo-shuru-kare-start-karte-hain-aarambh-karte-hain-gif-19658644&amp;image=https%3A%2F%2Fc.tenor.com%2Fh79iiWcDcoUAAAAC%2Fshuru-karte-hain-shuru-karo.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/be22bced7108b43760f7cb7e6aeebf1e/href">https://medium.com/media/be22bced7108b43760f7cb7e6aeebf1e/href</a></iframe><p>In this article, we are going to learn about Google maps implementation in flutter. We will cover the below points -</p><ol><li>Current location</li><li>Drawing Polygons and Polylines</li><li>Getting address from Latitude and longitude and vice-versa</li></ol><p><strong>Configuration Required- Make these changes in the files accordingly.</strong></p><p><strong>Android- AndroidManifest.xml</strong></p><pre>android {<br> defaultConfig {<br> minSdkVersion 20<br> }<br>}<br></pre><pre>&lt;manifest …<br> &lt;application …<br> &lt;meta-data android:name=”com.google.android.geo.API_KEY”<br> android:value=”YOUR KEY HERE”/&gt;</pre><p><strong>iOS- AppDelegate.swift</strong></p><pre>import UIKit<br>import Flutter<br>import GoogleMaps</pre><pre><a href="http://twitter.com/UIApplicationMain">@UIApplicationMain</a><br><a href="http://twitter.com/objc">@objc</a> class AppDelegate: FlutterAppDelegate {<br> override func application(<br> _ application: UIApplication,<br> didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?<br> ) -&gt; Bool {<br> GMSServices.provideAPIKey(“YOUR KEY HERE”)<br> GeneratedPluginRegistrant.register(with: self)<br> return super.application(application, didFinishLaunchingWithOptions: launchOptions)<br> }<br>}</pre><p>After the above steps, we require the below-mentioned dependencies and require Google API key from here(<a href="https://cloud.google.com/maps-platform/">https://cloud.google.com/maps-platform/</a>) or use any other project’s key.</p><ul><li><strong>google_maps_flutter</strong>: For map</li><li><strong>geocoding</strong>: For converting address to LatLng and vice-versa</li><li><strong>geolocator</strong>: For the current location</li></ul><p>Now let&#39;s come to the coding part and implement the discussed points.</p><pre>// For showing the currennt location of the user</pre><pre><strong>static const </strong>CameraPosition <em>cp </em>=<br>    CameraPosition(target: LatLng(20.987654, 78.98765), zoom: 4); <br><br>Completer&lt;GoogleMapController&gt; <strong>controller </strong>= Completer();</pre><pre><br>@override<br><strong>void </strong>initState() {<br>  currentLocation();<br>}</pre><pre>currentLocation() {<br>  getCurrentLocation().then((value) <strong>async </strong>{<br>    markers.add(Marker(<br>        markerId: MarkerId(<strong>&#39;Current&#39;</strong>),  <br>        position: LatLng(value.longitude, value.latitude),<br>        infoWindow: InfoWindow(title: <strong>&#39;Current Pos&#39;</strong>)));<br>    CameraPosition cammPos = CameraPosition(<br>        target: LatLng(value.latitude, value.longitude), zoom: 14);<br>    GoogleMapController gmc = <strong>await </strong>controller.future;<br>    gmc.animateCamera(CameraUpdate.newCameraPosition(cammPos));<br>    setState(() {});<br>  });<br>}<br></pre><pre>Future&lt;Position&gt; getCurrentLocation() <strong>async </strong>{<br>  <strong>await </strong>Geolocator.<em>requestPermission</em>()<br>      .then((value) {})<br>      .onError((error, stackTrace) {<br>    print(<strong>&quot;</strong>$error<strong>    Error&quot;</strong>);<br>  });<br>  <strong>return await </strong>Geolocator.<em>getCurrentPosition</em>();<br>}</pre><pre><br>// this is the build method</pre><pre>@override<br>Widget build(BuildContext context) {<br>  <strong>return </strong>Scaffold(<br>    body: SafeArea(<br>      child: Column(<br>        children: [<br>          <br>          Expanded(<br>            child: GoogleMap(<br>              initialCameraPosition: <em>cp</em>,<br>              markers: <strong>polyLineMarkers</strong>,<br>              mapType: MapType.<strong>normal</strong>,<br>              compassEnabled: <strong>true</strong>,<br>              polygons: <strong>polygonList</strong>,<br>              polylines: <strong>polylinneList</strong>,<em><br>              </em>onMapCreated: (GoogleMapController controllerr) {<br>      <br>                <strong>controller</strong>.complete(controllerr);<br>              },<br>            ),<br>          ),<br>        ],<br>      ),<br>    ),<br>  );<br>}</pre><pre>// Below is the code for converting address to LatLng and vice-versa</pre><pre>//define these 2 variables</pre><pre>String? <strong>address </strong>= <strong>&quot;Address&quot;</strong>;<br>String? <strong>latlngg </strong>= <strong>&quot;LatLng&quot;</strong>;</pre><pre><br>// Paste this inside build method</pre><pre>Text(<strong>&quot;</strong>$<strong>address   &quot;</strong>),<br>Text(<strong>&quot;</strong>$<strong>latlngg&quot;</strong>),<br> ElevatedButton(<br>child: Text(<strong>&quot;Convert&quot;</strong>)<br> onPressed: () <strong>async {</strong></pre><pre><em>  </em>List&lt;Location&gt; locations = <strong>await </strong>locationFromAddress(<strong>&quot;Noida 201301, India&quot;</strong>);<br>     <br>List&lt;Placemark&gt; placemarks =<strong>await </strong>placemarkFromCoordinates(20.987654, 78.98765);<br><br>setState(() {<br> <strong>address </strong>= locations.<strong>last</strong>.<strong>longitude</strong>.toString() +<br>                      <strong>&quot; , &quot; </strong>+ locations.<strong>last</strong>.<strong>latitude</strong>.toString();</pre><pre><br><strong>latlngg </strong>= placemarks.<strong>reversed</strong>.<strong>last</strong>.<strong>country</strong>.toString()+ placemarks.<strong>reversed</strong>.<strong>last</strong>.<strong>locality</strong>.toString();<br>               <br> });<br>             <br> },<br>              <br>),</pre><pre>// for drawing polygon and polyline</pre><pre>@override<br>  <strong>void </strong>initState() {<br>    <strong>polygonList</strong>.add(Polygon(<br>        polygonId: PolygonId(<strong>&#39;1&#39;</strong>),<br>        fillColor: Colors.<em>red</em>.withOpacity(0.3),<br>        points: <strong>polygonPoints</strong>,<br>        strokeWidth: 2,<br>        strokeColor: Colors.<em>red</em>,<br>        geodesic: <strong>true</strong>));<br><br><em>// showing markers on polyline<br>    </em><strong>for </strong>(int i = 0; i &lt; <strong>polylinnePoints</strong>.<strong>length</strong>; i++) {<br>      print(<strong>&quot;Polylineeeeeee&quot;</strong>);<br>      <strong>polyLineMarkers</strong>.add(Marker(<br>          markerId: MarkerId(i.toString()),<br>          position: <strong>polylinnePoints</strong>[i],<br>          infoWindow: <strong>const </strong>InfoWindow(title: <strong>&quot;Polyline&quot;</strong>)));<br>    }<br>    setState(() {});<br>    <strong>polylinneList</strong>.add(Polyline(<br>        polylineId: PolylineId(<strong>&#39;4567&#39;</strong>),<br>        color: Colors.<em>deepPurpleAccent</em>,<br>        points: <strong>polylinnePoints</strong>,<br>        width: 2));<br>    <strong>super</strong>.initState();<br><br>  }</pre><pre><em>//Polygon<br></em>Set&lt;Polygon&gt; <strong>polygonList </strong>= HashSet&lt;Polygon&gt;();<br>List&lt;LatLng&gt; <strong>polygonPoints </strong>= &lt;LatLng&gt;[<br>  LatLng(22.987654, 78.98765),<br>  LatLng(24.987654, 80.98765),<br>  LatLng(25.987654, 81.98765),<br>  LatLng(22.987654, 79.98765),<br>];</pre><pre><br><em>//PolyLine<br></em>Set&lt;Polyline&gt; <strong>polylinneList </strong>= {};<br>Set&lt;Marker&gt; <strong>polyLineMarkers </strong>= {};<br>List&lt;LatLng&gt; <strong>polylinnePoints </strong>= &lt;LatLng&gt;[<br>  LatLng(18.987654, 78.98765),<br>  LatLng(19.987654, 80.98765),<br>  LatLng(20.987654, 81.98765),<br>  LatLng(21.987654, 82.98765),<br>];</pre><pre>@override<br>Widget build(BuildContext context) {<br>  <strong>return </strong>Scaffold(<br>    body: SafeArea(<br>      child: Expanded(<br>            child: GoogleMap(<br>              initialCameraPosition: <em>cp</em>,<br>              markers: <strong>polyLineMarkers</strong>,<br>              mapType: MapType.<strong>normal</strong>,<br>              compassEnabled: <strong>true</strong>,<br>              polygons: <strong>polygonList</strong>,<br>              polylines: <strong>polylinneList</strong>,<br>            <em> </em>onMapCreated: (GoogleMapController controllerr) {<br>               <br>                <strong>controller</strong>.complete(controllerr);<br>              },<br>            ),<br>          ),<br>      ),<br>  );<br>}<br></pre><p>This is how it will look.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*r9GnBZ6VOEYJ3pMW8e7_1w.jpeg" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F12546031&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fphew-thank-god-oh-relief-glad-thats-over-gif-12546031&amp;image=https%3A%2F%2Fc.tenor.com%2F1p9_irK3_w4AAAAC%2Fphew-thank-god.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e836879c23efb9882ea8fcb3b0eb49c6/href">https://medium.com/media/e836879c23efb9882ea8fcb3b0eb49c6/href</a></iframe><p><strong>Conclusion</strong></p><p>We have learnt about google map implementation, which is commonly used in many applications. This is all from my side in this article and thank you for reading and giving your time. If you face any difficulty in understanding anything, you can surely contact to me.</p><p>Github- <a href="https://github.com/riyatyagi99">https://github.com/riyatyagi99</a></p><p><strong>Repo</strong>-fl_june2022/lib/google_mapss</p><p><a href="https://www.linkedin.com/in/riya-tyagi-5b42a313a/">https://www.linkedin.com/in/riya-tyagi-5b42a313a</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f1deb990e0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Sign-in with Flutter using Firebase Authentication]]></title>
            <link>https://medium.com/@tyagi.riyaa2022/google-sign-in-with-flutter-using-firebase-authentication-11ebd4cc4554?source=rss-c80865a2a129------2</link>
            <guid isPermaLink="false">https://medium.com/p/11ebd4cc4554</guid>
            <dc:creator><![CDATA[Riya Tyagi]]></dc:creator>
            <pubDate>Wed, 20 Jul 2022 10:18:48 GMT</pubDate>
            <atom:updated>2023-02-28T12:37:27.368Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2F5pO9zMzgGrUYSEXRjEPQ.png" /></figure><p>In this blog, we are going to talk about how do we sign in with Google using Firebase Authentication. Other sign-in methods are also available in Firebase such as Phone, Email/Password, Facebook, Twitter, Yahoo, etc.</p><p><strong>This blog includes:</strong></p><ol><li>Dependencies needed</li><li>Firebase setup</li><li>Authentication</li><li>Code Implementation</li><li>Code File</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FhTBkgmCL1g79DUvAiR%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FhTBkgmCL1g79DUvAiR%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FhTBkgmCL1g79DUvAiR%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/21ca69db03ee54cf4fc53a9227445755/href">https://medium.com/media/21ca69db03ee54cf4fc53a9227445755/href</a></iframe><h3><strong>Dependencies</strong></h3><blockquote>We need two dependencies, <strong>firebase_auth </strong>and <strong>google_sign_in</strong>. You will get these from the pub.dev and select the latest version. Then copy these and paste them into <strong>pubspec.yaml file</strong></blockquote><h3><strong>Firebase setup</strong></h3><p>First, open the <strong>Firebase console</strong> and then click on the “<strong>Add Project”</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*hDcl59WjguLZMFw_Fz5YJg.png" /></figure><p><strong>There are three steps after that.</strong></p><blockquote>First, you will see the below screen and add your Project name there, whatever you want to keep. After that click on <strong>“Continue”.</strong></blockquote><blockquote>Then in the second step, click on <strong>“Continue” </strong>again,</blockquote><blockquote>And in the third, select the default account and <strong>“Continue” </strong>again.</blockquote><blockquote>This will create your project, you can see it on the dashboard.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*943LUKt9W2-yPmyn-koVwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7eCYkFw90tywo9q2Hdvz6A.png" /></figure><p>Then add the app where you want to sign in like Android or iOS. In this, I have selected the <strong>Android app</strong> and you will get like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4_IP9RZMz3NOWV38olkig.png" /></figure><ul><li>The package name should be the same as it&#39;s in your AndroidManifest.xml file.</li><li>Now download the <strong>google-services.json. </strong>Move the downloaded google-serivces.json file into your Android<strong> app module root directory</strong>.</li><li>Add the dependencies shown in the third step in the Android build Gradle files.</li></ul><p>Add your<strong> project-level build.gradle</strong> file.</p><pre>dependencies <strong>{<br>    </strong>classpath &#39;com.android.tools.build:gradle:3.5.0&#39;<br>    classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;<br>classpath &#39;com.google.gms:google-services:4.3.3&#39;<br><strong>}</strong></pre><p>Add your <strong>project app-level build. Gradle </strong>file</p><pre>dependencies <strong>{<br>    </strong>implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;<br>    implementation &#39;com.google.firebase:firebase-analytics:17.2.2&#39;<strong>}<br></strong>apply plugin: &#39;com.google.gms.google-services&#39;</pre><p><strong>NOTE: Same steps to be followed for iOS integration</strong></p><h3><strong>Authentication</strong></h3><p>Select the Authentication from the left side of the Firebase console and you will see this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZ2GSCpgNa5C_RSXJYkKZA.png" /></figure><ul><li>Select Google from it and enable this option as shown below. Then add your Project support email and save it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqFkNWBIxAOU1USidiQC2A.png" /></figure><h3><strong>Code Implementation</strong></h3><p>In this there is a sign in button and click on it.</p><pre><strong>class </strong>_GooglebtnState <strong>extends </strong>State&lt;Googlebtn&gt; {<br>  GoogleSignIn <strong>googleSignIn </strong>= GoogleSignIn();<br><br>  Future &lt;User&gt; signIn()<strong>async</strong>{<br>    GoogleSignInAccount? googleUser=<strong>await googleSignIn</strong>.signIn();<br><br>    <strong>final </strong>googleAuth= <strong>await </strong>googleUser!.<strong>authentication</strong>;<br><br>    <strong>final </strong>credential=GoogleAuthProvider.<em>credential</em>(<br>        accessToken:googleAuth.<strong>accessToken </strong>,<br>        idToken:googleAuth.<strong>idToken<br>    </strong>);<br>   UserCredential authResult= <strong>await </strong>FirebaseAuth.<em>instance</em>.signInWithCredential(credential);<br>    User? user = <strong>await </strong>authResult.<strong>user</strong>;<br>    <strong>return </strong>user!;<br>  }<br><br>  @override<br>  Widget build(BuildContext context){<br>    <strong>return </strong>Scaffold(<br>      body: Center(<br>        child: ElevatedButton(<br>          onPressed: (){<br>           signIn().then((user) {<br>             <strong>if</strong>(user!=<strong>null</strong>){<br>               Navigator.<em>push</em>(<br>                   context,<br>                   MaterialPageRoute(builder:(context)=&gt;DetailedPage(user:user)));<br>             }<strong>else</strong>{<br>               Fluttertoast.<em>showToast</em>(msg: <strong>&quot;Need to check&quot;</strong>);<br>             }<br>           });<br>          },<br>          child: Text(<strong>&quot;Sign in&quot;</strong>),<br>        ),<br>      ),<br>    );<br>  }<br><br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*qaJaWpLMdfyMyCHzLtUUNw.png" /></figure><p>After this, Select the account with which you want to continue and you will be signed in and will get the desired details and information.</p><pre>////This is next page after signin.</pre><pre><strong>class </strong>DetailedPage <strong>extends </strong>StatefulWidget {<br> <strong>final </strong>User? <strong>user</strong>;<br>  <strong>const </strong>DetailedPage({Key? key,<strong>this</strong>.<strong>user</strong>}) : <strong>super</strong>(key: key);<br><br>  @override<br>  _DetailedPageState createState() =&gt; _DetailedPageState();<br>}</pre><pre><br>Text(<strong>&quot;Email        &quot;</strong>+<strong>widget</strong>.<strong>user</strong>!.<strong>email</strong>.toString()),<br>Text(<strong>&quot;Name     &quot;</strong>+<strong>widget</strong>.<strong>user</strong>!.<strong>displayName</strong>.toString()),<br>Text(<strong>&quot;URL     &quot;</strong>+<strong>widget</strong>.<strong>user</strong>!.<strong>photoURL</strong>.toString()),</pre><h3><strong>SignOut</strong></h3><pre>GoogleSignIn <strong>googleSignIn </strong>= GoogleSignIn();</pre><pre><strong>void </strong>signOut() {<br>  <strong>googleSignIn</strong>.disconnect();<br>  FirebaseAuth.<em>instance</em>.signOut();<br>  print(<strong>&quot;user signed out&quot;</strong>);<br>}</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FMAzkuVTtXuCsqtDiFM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FMAzkuVTtXuCsqtDiFM%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FMAzkuVTtXuCsqtDiFM%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/c21768c956d5fa255c4a7d7a89a2255b/href">https://medium.com/media/c21768c956d5fa255c4a7d7a89a2255b/href</a></iframe><h3>Conclusion</h3><p>So Google sign-in is done from my side and it is the latest code that is working. Follow each and every step mentioned in the article and I believe you will do it.</p><p>Github- <a href="https://github.com/riyatyagi99">https://github.com/riyatyagi99</a></p><p><strong>Repo</strong>-new_widgets/lib/firebase/google_sign_in</p><p><a href="https://www.linkedin.com/in/riya-tyagi-5b42a313a/">https://www.linkedin.com/in/riya-tyagi-5b42a313a</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11ebd4cc4554" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Downloading Files in Flutter]]></title>
            <link>https://medium.com/@tyagi.riyaa2022/downloading-files-in-flutter-fef1e9b73081?source=rss-c80865a2a129------2</link>
            <guid isPermaLink="false">https://medium.com/p/fef1e9b73081</guid>
            <dc:creator><![CDATA[Riya Tyagi]]></dc:creator>
            <pubDate>Thu, 16 Jun 2022 10:46:32 GMT</pubDate>
            <atom:updated>2022-08-03T05:44:23.613Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog is about how to download files in Flutter. I am writing this blog as I was facing some problems while downloading the file.</p><p><strong>Problem: </strong>While clicking on the download button, sometimes my <strong>application</strong> <strong>crashed</strong> and sometimes it showed <strong>Failed</strong> even after downloading the file.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FWH85q8e201wlO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FWH85q8e201wlO%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FWH85q8e201wlO%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="301" frameborder="0" scrolling="no"><a href="https://medium.com/media/279acef053d51181e23832382b6734e1/href">https://medium.com/media/279acef053d51181e23832382b6734e1/href</a></iframe><p><strong>Solution:</strong> As we know that UI renders on the main isolate, while download events come from the background isolate or code in callback runs in the background isolate. So, handling the communication between 2 isolates is important.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F5z0cCCGooBQUtejM4v%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F5z0cCCGooBQUtejM4v%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExcmEweWVrMjE0bDJjN3h0ZjgyeGR0Ym91amUzanRqNmtianRib2JhMyZlcD12MV9naWZzX2dpZklkJmN0PWc%2F5z0cCCGooBQUtejM4v%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5edd7a723652cc0433aa74aac868b1e/href">https://medium.com/media/f5edd7a723652cc0433aa74aac868b1e/href</a></iframe><p><strong>Packages Used: </strong>flutter_downloader: ^1.8.0+1 , path_provider: ^2.0.9</p><p><strong>Android integration- </strong>Paste this in the AndroidManifest.xml file.</p><blockquote>&lt;provider<br> android:name=”vn.hunghd.flutterdownloader.DownloadedFileProvider”<br> android:authorities=”${applicationId}.flutter_downloader.provider”<br> android:exported=”false”<br> android:grantUriPermissions=”true”&gt;<br> &lt;meta-data<br> android:name=”android.support.FILE_PROVIDER_PATHS”<br> android:resource=”@xml/provider_paths”/&gt;<br>&lt;/provider&gt;</blockquote><p><strong>iOS integration- </strong>Open iOS project in Xcode<strong>.</strong></p><ol><li><strong>Enable background Mode</strong>.</li></ol><p>Steps- Runner →Capabilities →Background Modes-ON(Tick on — Background Fetch and Remote Notifications</p><p><strong>2. Adding Squlite Library.</strong></p><p>Steps- Runner → General — -&gt;See Linked frameworks and Libraries →Click on the <strong>+</strong> button (shown + — below) →Search Squilite and Add it.</p><p><strong>3.Check AppDelegate File.</strong></p><blockquote>import UIKit<br>import Flutter<br>import flutter_downloader</blockquote><blockquote>@UIApplicationMain<br>@objc class AppDelegate: FlutterAppDelegate {<br> override func application(<br> _ application: UIApplication,<br> didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?<br> ) -&gt; Bool {<br> GeneratedPluginRegistrant.register(with: self)<br> FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)<br> return super.application(application, didFinishLaunchingWithOptions: launchOptions)<br> }<br>}</blockquote><blockquote>private func registerPlugins(registry: FlutterPluginRegistry) {<br> if (!registry.hasPlugin(“FlutterDownloaderPlugin”)) {<br> FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: “FlutterDownloaderPlugin”)!)<br> }<br>}</blockquote><p>Let’s get started with the code.</p><pre><strong>// Write this inside the class above initState method</strong></pre><pre>int <strong>progress </strong>= 0;<br>ReceivePort <strong>_receivePort </strong>= ReceivePort();<br><strong>static </strong><em>downloadingCallback</em>(id, status, progress) {<br>  <em>///Looking up for a send port<br>  </em>SendPort? sendPort = IsolateNameServer.<em>lookupPortByName</em>(<strong>&quot;downloading&quot;</strong>);<br>  <em>///ssending the data<br>  </em>sendPort!.send([id, status, progress]);<br>}</pre><pre>@override<br><strong>void </strong>initState() {<br>  <em>// </em><strong><em>TODO: implement initState<br>  </em>super</strong>.initState();<br>  <em>///register a send port for the other isolates<br>  </em>IsolateNameServer.<em>registerPortWithName</em>(<strong>_receivePort</strong>.<strong>sendPort</strong>, <strong>&quot;downloading&quot;</strong>);<br>  <em>///Listening for the data is comming other isolataes<br>  </em><strong>_receivePort</strong>.listen((message) {<br>    <em>setState(() {<br>      progress = message[2];<br>    });<br>    print(progress);<br>  </em>});<br>  FlutterDownloader.<em>registerCallback</em>(<em>downloadingCallback</em>);<br>}</pre><pre>........................................................</pre><pre>//download button- click on it to download</pre><pre>ElevatedButton(<br>  style: ElevatedButton.<em>styleFrom</em>(<br>      padding: EdgeInsets.symmetric(horizontal: 15,vertical: 10),<br>      primary: <strong>Colors.black</strong>,<br>      onPrimary: <strong>Colors.white</strong>,<br>      shape: RoundedRectangleBorder(<br>          borderRadius: BorderRadius.circular(20.0))<br>  ),<br>  child:Text(&quot;Download File),<br> onPressed:(){<br>     String url=&quot;<a href="https://picsum.photos/200">https://picsum.photos/200</a>&quot;;<br>     downloadFile(url);    //Any file url you want to download<br>},);</pre><pre>...............................................................</pre><pre>// Above method - downloadFile</pre><pre>void downloadFile(String url) <strong>async </strong>{<br>  <strong>final </strong>status = <strong>await </strong>Permission.<em>storage</em>.request();<br><br>  <strong>try</strong>{<br>    <strong>if </strong>(status.<strong>isGranted</strong>) {<br>      String name = url.split(<strong>&quot;/&quot;</strong>).<strong>last</strong>;<br><br>      <strong>final </strong>dir =Platform.<em>isAndroid</em>? <strong>await </strong>getExternalStorageDirectory():<strong>await </strong>getApplicationSupportDirectory(); <em>//From path_provider package<br>      </em><strong>var </strong>localPath = dir!.<strong>path </strong>+ name;<br>      print(<strong>&quot;</strong>$localPath<strong>  111111111111111&quot;</strong>);<br>      <strong>final </strong>savedDir = Directory(localPath);<br>      <strong>final </strong>taskid = <strong>await </strong>FlutterDownloader.<em>enqueue</em>(<br>        url: url,<br>        fileName: <strong>&quot;</strong>$name<strong>&quot;</strong>,<br>        savedDir: dir.<strong>path</strong>,<br>        showNotification: <strong>true</strong>,<br>        openFileFromNotification: <strong>true</strong>,<br>      );<br>      print(taskid);<br>    } <strong>else </strong>{<br>      print(<strong>&#39;Permission Denied&#39;</strong>);<br>      <strong>if </strong>(<strong>await </strong>Permission.<em>storage</em>.request().<strong>isGranted</strong>) {<br>        <em>// Either the permission was already granted before or the user just granted it.<br>      </em>}<br>    }<br>  }<strong>catch</strong>(e){<br>    <strong>throw </strong>Exception(<strong>&#39;</strong>$e<strong>&#39;</strong>);<br>  }<br><br>}</pre><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NCA48AXWm9-mzLJGxCiCEw.jpeg" /></figure><p>Hope you enjoyed and found this article useful. Thank you for reading!</p><p>Follow me for more interesting blogs and articles!</p><p>Github- <a href="https://github.com/riyatyagi99/fl_june2022/tree/main/lib/downloading_file">https://github.com/riyatyagi99/fl_june2022/tree/main/lib/downloading_file</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fef1e9b73081" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>