<?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 Anusha Vijayan  on Medium]]></title>
        <description><![CDATA[Stories by Anusha Vijayan  on Medium]]></description>
        <link>https://medium.com/@anusha.vijayan.88?source=rss-3893e0f6e882------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GRAVVhZgwhfkfg28</url>
            <title>Stories by Anusha Vijayan  on Medium</title>
            <link>https://medium.com/@anusha.vijayan.88?source=rss-3893e0f6e882------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:23:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anusha.vijayan.88/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[Flutter Web + Firebase Push Notification]]></title>
            <link>https://medium.com/@anusha.vijayan.88/flutter-web-firebase-push-notification-99ec82e3fc13?source=rss-3893e0f6e882------2</link>
            <guid isPermaLink="false">https://medium.com/p/99ec82e3fc13</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[push-notification]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Anusha Vijayan ]]></dc:creator>
            <pubDate>Wed, 29 Mar 2023 17:31:00 GMT</pubDate>
            <atom:updated>2023-03-30T05:28:56.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*Z1DvjJZrsbc0QLjxQH0fSQ.png" /></figure><p>Push notifications are small, pop-up messages sent to a user’s device that appear even when the app isn’t open.</p><p>Let’s get started:</p><ol><li>Create a Flutter web support project (I am assuming you have done it already).</li><li>Create a firebase web project from the firebase console.</li></ol><p>You can create a firebase project from <a href="https://console.firebase.google.com/"><strong>https://console.firebase.google.com/</strong></a></p><p>3. Add <strong>firebase_core</strong> and <strong>firebase_messaging</strong> in the pubspec.yaml file.</p><p>4. Create a <strong>firebase-messaging-sw.js</strong> file in the project directory inside the web folder and add the below code.</p><pre>importScripts(&#39;https://www.gstatic.com/firebasejs/9.0.0/firebase-app-compat.js&#39;);<br>importScripts(&#39;https://www.gstatic.com/firebasejs/9.0.0/firebase-messaging-compat.js&#39;);<br>  firebase.initializeApp({<br>     apiKey: &quot;&quot;,<br>     authDomain: &quot;&quot;,<br>     projectId: &quot;&quot;,<br>     storageBucket: &quot;&quot;,<br>     messagingSenderId: &quot;&quot;,<br>     appId: &quot;&quot;<br>  });<br><br>  const messaging = firebase.messaging();<br>  // Optional:<br>  messaging.onBackgroundMessage((message) =&gt; {<br>    console.log(&quot;onBackgroundMessage&quot;, message);<br>  });</pre><p>Here the firebase.initializeApp() need your project settings, which you can find from the firebase console.</p><p>Go to your project settings page in the console, find and select your desired webapp and there you can find the app configurations. Copy the same and paste it.</p><p>5. Edit the <strong>index.html</strong> file in the web folder</p><pre>&lt;body&gt;<br>.....<br>&lt;script src=&quot;main.dart.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;<br>&lt;script type=&#39;module&#39;&gt;<br>       if (&#39;serviceWorker&#39; in navigator) {<br>          // Service workers are supported. Use them.<br>          window.addEventListener(&#39;load&#39;, function () {<br>            // ADD THIS LINE<br>            navigator.serviceWorker.register(&#39;/firebase-messaging-sw.js&#39;);<br><br>            // Wait for registration to finish before dropping the &lt;script&gt; tag.<br>            // Otherwise, the browser will load the script multiple times,<br>            // potentially different versions.<br>            var serviceWorkerUrl = &#39;flutter_service_worker.js?v=&#39; + serviceWorkerVersion;<br><br>            //  ...<br>          });<br>      }<br>&lt;/script&gt;<br>&lt;/body&gt;</pre><p>6. Now call firebase.initializeApp() method inside main.dart</p><pre>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await Firebase.initializeApp(<br>      options: const FirebaseOptions(<br>          apiKey: &quot;&quot;,<br>          authDomain: &quot;&quot;,<br>          projectId: &quot;&quot;,<br>          storageBucket: &quot;&quot;,<br>          messagingSenderId: &quot;&quot;,<br>          appId: &quot;&quot;));<br>  runApp(const MyApp());<br>}</pre><p>7. Then add a message listener for the incoming push notification messages.</p><pre>@override<br>void initState() {<br>  getToken();<br>  FirebaseMessaging.onMessage.listen(showNotification);<br>  FirebaseMessaging.onBackgroundMessage(showNotificationOnBackground);<br>  super.initState();<br>}<br><br>getToken() async {<br>  FirebaseMessaging messaging = FirebaseMessaging.instance;<br>  fcmToken = await messaging.getToken();<br>  print(&#39;FCM Token: $fcmToken&#39;);<br>}<br><br>Future&lt;void&gt; showNotificationOnBackground(RemoteMessage message) async {<br>    RemoteNotification? notification = message.notification;<br>    if (notification != null) {<br>      print(&#39;Notification onBackground : ${notification.title.toString()}&#39;);<br>    }<br>  }<br><br>  showNotificationOnForeground(RemoteMessage message) {<br>    RemoteNotification? notification = message.notification;<br>    if (notification != null) {<br>      print(&#39;Notification Foreground : ${notification.title.toString()}&#39;);<br>    }<br>  }</pre><p>Note: The above code is for reference purpose only, you need to change the code based on your requirements. And also once you save the FCM token you need to remove the getToken() method and add a token change listener for tracking and saving the token.</p><p>Now you can run the app and should be able to test and get notifications.</p><p>8. You can now send test notifications from firebase console.</p><p>Go to <strong>firbase console</strong> -&gt; select your <strong>project</strong> -&gt; select <strong>messaging</strong> option from the menu -&gt; under the <strong>campaign</strong> tab -&gt; select a <strong>New campaign</strong> -&gt; choose N<strong>otifications</strong>. There you can add notification <strong>title</strong> and <strong>text </strong>and click on <strong>Send test message</strong>, then need to enter the <strong>FCM token</strong>(mentioned earlier in the above code), for identifying the device. On click of <strong>Test</strong> will send notifications to your device.</p><p>note:</p><p>The Firebase Cloud Messaging (FCM) token may be refreshed under the following circumstances:</p><ol><li>The app is restored on a new device.</li><li>The user uninstalls and reinstalls the app.</li><li>The user clears app data.</li><li>Google Play services data gets cleared.</li><li>The app requests a new token using getToken().</li></ol><p>For more information please refer the below link:</p><p><a href="https://firebase.google.com/docs/cloud-messaging/flutter/client">Set up a Firebase Cloud Messaging client app on Flutter</a></p><p>Thank you :) Have a nice day..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99ec82e3fc13" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Web App -Firebase Hosting]]></title>
            <link>https://medium.com/@anusha.vijayan.88/flutter-web-app-firebase-hosting-717d68b5b9b1?source=rss-3893e0f6e882------2</link>
            <guid isPermaLink="false">https://medium.com/p/717d68b5b9b1</guid>
            <category><![CDATA[firebasehosting]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-web]]></category>
            <dc:creator><![CDATA[Anusha Vijayan ]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 07:30:17 GMT</pubDate>
            <atom:updated>2023-04-20T06:21:39.497Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*CTiBDs4KRCZNlbhMk6oWCw.png" /></figure><p>It is very simple to host your Flutter Web App with Firebase Hosting.</p><p>Steps to create a Firebase Project:</p><ol><li>Open the Firebase console :<a href="https://console.firebase.google.com/">https://console.firebase.google.com/</a> and create your project.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZfIppg92gJDgtJ_8IR0rg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkHQ_5CpiJyTpRMbWXB8WQ.png" /></figure><p>On clicking <strong>Continue</strong> will go to next page, where you can select the Google Analytics Option, for the time being I am disabling the option and creating my Firebase project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lqzvXRzxdGZVYWrCKtTtxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*awPc_OrY4YgFYzLYwwUWfw.png" /></figure><p>Yes!!, your project is ready now.</p><p><strong>2. Install firebase-tools CLI.</strong></p><p>If you do not have <strong>npm</strong>, you must install that first.</p><p>Install node.js from <a href="https://nodejs.org/en">https://nodejs.org/en</a></p><p>Once it is installed run the following command,</p><p><strong>$ npm install -g firebase-tools</strong></p><p>Now the firebase-tools installed on your machine.</p><p><strong>3.Initialize Hosting for your firebase Project</strong></p><p>Open a terminal window and navigate to or you can open you project in the editor and run the following command.</p><p><strong>$ firebase login</strong></p><p><em>if you want to change the logged user then you need to first log out from the account and again login:</em></p><p><strong><em>$ firebase logout</em></strong></p><p>If you have multiple projects on Firebase then you need to verify the selected project is intended one.</p><p>List all projects : <strong>$ firebase projects:list</strong></p><p>then select your project by the below command :</p><p><strong>$ firebase use projectId</strong></p><p>Next you need to Initiate your project.</p><p>Run this command from your app’s root directory:</p><p><strong>$ firebase init</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cou6i6hlGhUdTc9gcArHlw.png" /></figure><p>Use the <strong>down arrow keys</strong> for reaching the Hosting option and use the <strong>spacebar</strong> for selecting the same. Then will see the below screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*6yBeVFEHWH2c3y1mdKe9Jw.png" /></figure><p>You can select your project from the list by choosing the existing project option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9pJbB2sHQf_scR5X-yjHw.png" /></figure><p>Then, enter <strong>build/web</strong> as the public directory and press enter. Then answer rest of the questions as per your need.</p><p>Now the initialization is completed.</p><p><strong>4. Build your App and Deploy in to Firebase</strong></p><p>run the below command for building the web app:</p><p>$ <strong>flutter build web</strong></p><p>Then finally , run:</p><p>$ <strong>firebase deploy</strong></p><p>Now your web app is deployed in the Firebase and you can find your <strong>hosting url</strong> in the terminal.</p><p><em>Thank You. Happy coding!!!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=717d68b5b9b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dart — Map Data type]]></title>
            <link>https://medium.com/@anusha.vijayan.88/dart-map-data-type-a6507e5f61cf?source=rss-3893e0f6e882------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6507e5f61cf</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Anusha Vijayan ]]></dc:creator>
            <pubDate>Sat, 18 Mar 2023 14:21:09 GMT</pubDate>
            <atom:updated>2023-03-18T14:22:19.127Z</atom:updated>
            <content:encoded><![CDATA[<h3>Dart — Map Methods</h3><p><strong>Dart Map is an object that stores data in the form of a key-value pair, </strong>from which you retrieve a value using its associated key. Here each key, which is unique, has exactly one value associated with it.</p><p>Here are some of the most commonly used Dart map methods:</p><p><strong>containsKey</strong>(): This method checks whether the current map object contains a given key. It takes a key as its only argument and returns a Boolean value.</p><p><strong>containsValue</strong>(): This method checks whether the current map object contains a given value. It takes a value as its only argument and returns a Boolean value.</p><p><strong>isEmpty</strong>(): This method checks whether the current map object is empty. It takes no arguments and returns a Boolean value.</p><p><strong>addAll</strong>(): This method adds all the key-value pairs from another map object to the current map object. It takes a map object as its only argument.</p><p><strong>forEach</strong>(): This method iterates over the key-value pairs in the current map object and applies a function to each pair. It takes a function as its only argument.</p><p><strong>keys</strong>(): This method returns an iterable object containing all the keys in the current map object.</p><p><strong>values</strong>(): This method returns an iterable object containing all the values in the current map object. It takes no arguments.</p><p><strong>update</strong>(): This built-in method will update the value associated with a given key.</p><p><strong>updateAll</strong>(): This method iterates over all entries in the map and updates them with new values.</p><p><strong>remove</strong>(): This method removes a key-value pair from the current map object. It takes a key as its only argument.</p><p><strong>removeWhere</strong>(): This method will remove all entries which satisfies the condition.</p><p><strong>clear</strong>(): This method removes all the key-value pairs from the current map object. It takes no arguments.</p><p><strong>putIfAbsent</strong>(): The function takes two arguments, the key and a function that will return the new value, if needed. If there is a value associated with the key, it is returned. Otherwise, it uses ifAbsent() to get a new value, associates key with it, and returns the new value.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6507e5f61cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[List Methods in Dart]]></title>
            <link>https://medium.com/@anusha.vijayan.88/list-methods-in-dart-458f2753fe9a?source=rss-3893e0f6e882------2</link>
            <guid isPermaLink="false">https://medium.com/p/458f2753fe9a</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Anusha Vijayan ]]></dc:creator>
            <pubDate>Sun, 12 Mar 2023 06:50:51 GMT</pubDate>
            <atom:updated>2023-03-12T06:50:51.203Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>List Methods in Dart</strong></p><p>A List is an ordered collection of objects in which each value is assigned with an index.</p><p>There are many List Methods in Dart, we will take a look at some of them with examples.</p><p>Reference list :<strong>List&lt;int&gt; intList = &lt;int&gt;[2,1];</strong></p><p>1. <strong>isEmpty</strong> : It will return true if it is empty and false for not empty.</p><p>print(intList.isEmpty); /// false</p><p>2. <strong>isNotEmpty</strong> : It will return true if it is not empty and false for empty.</p><p>print(intList.isNotEmpty); /// true</p><p>3. <strong>length</strong>: It will return the total no of elements in the list</p><p>print(intList.length); /// 2</p><p>4. <strong>add</strong> : It will add new elements in the list</p><p>intList.add(3); print(intList); /// [2,1,3]</p><p>intList.add(‘3’); print(intList); /// cause error because of its unmatched data type.</p><p>5. <strong>remove()</strong> : This will remove the particular item.</p><p>intList.remove(3); ///[2,1]</p><p>6. <strong>first</strong> : returns the first element if it is not empty, else throws a state error.</p><p>print(intList.first); ///2</p><p>7. <strong>last</strong> : returns the last element if it is not empty, else throws a state error.</p><p>print(intList.last); ///1</p><p>8. <strong>contains()</strong> : This will check whether the List contains an element and will returns a Boolean.</p><p>print(intList.contains(2)); ///true</p><p>9. <strong>sort()</strong> : This will sort the list elements.</p><p>intList.sort((a,b)=&gt;a.compareTo(b)); /// [1,2]</p><p>10.<strong>reversed</strong> : It will return an Iterable of elements in reversed order.</p><p>intList = intList.reversed.toList();</p><p>print(intList); /// [2,1]</p><p>11.<strong>reduce()</strong> : Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.</p><p>int total = intList.reduce((curr, next) =&gt; curr + next);</p><p>print(total); ///3</p><p>12.<strong>fold()</strong> : Reduces a collection to a single value by iteratively combining each element of the collection with an existing value.</p><p>int total = intList.fold(0,(curr, next) =&gt; curr + next);</p><p>print(total); ///3</p><p>int total = intList.fold(10,(curr, next) =&gt; curr + next);</p><p>print(total); ///13</p><p><strong>13.fillRange(): </strong>This will over writes the range of elements with fill value.</p><p>The list must be growable. The index value must be non-negative and no greater than length.</p><p>List&lt;int&gt; str = [2,1,3,4];</p><p>str.fillRange(1,2,5); ///fillRange(int start, int end, int? fillValue)</p><p>print(str); ///[2, 5, 3, 4]</p><p>14.<strong>insert() : </strong>This will insert an element at the specified index</p><p>List&lt;int&gt; str = [2,1,3,4];<br>str.insert(1,2); ///insert(index,newValue);<br>print(str); ///[2, 2, 1, 3, 4]</p><p>15.<strong>shuffle</strong>():This will shuffle the elements of the list randomly.</p><p>intList.<strong>shuffle</strong>();</p><p>print(intList);/// [1, 2, 3, 2, 4] OR some other random result.</p><p>16.<strong>asMap();</strong></p><p>This method returns a map representation of the given list. The key will be the indices and the value will be the corresponding elements of the list.</p><p>List&lt;String&gt; alphabets = [‘a’,’b’,’c’,’d’];</p><p>Map&lt;int, String&gt; mapResult = alphabets.asMap();</p><p>print(mapResult); /// {0: a, 1: b, 2: c, 3: d}</p><p>17.<strong>whereType()</strong>: Returns a new Iterable with all elements that have the specified data type.</p><p>List mixedList = [2,’a’,3,’b’,’c’];</p><p>List&lt;int&gt; newIntList = mixedList.whereType&lt;int&gt;().toList(); /// [2, 3]</p><p>18.<strong>firstWhere()</strong>: This method returns the first element that satisfies the given predicate test.</p><p>List newList = [1,2,3,4];</p><p>newList. firstWhere((i) =&gt; i &gt;2) ;///3</p><p>19.<strong>singleWhere()</strong>: This method returns the first matching element from the list when there’s an <em>exact</em> match</p><p>List newList = [2,3,1];</p><p>newList. singleWhere((i) =&gt; i &gt;2) ;///3</p><p>newList. singleWhere((i) =&gt; i &gt;1) ;/// caught error: Too many elements</p><p>20.<strong>clear</strong> : removes all the objects from the list</p><p>intList.clear();</p><p>print(intList);/// [] empty list.</p><p>There are more List methods in Dart that we will explore at a later time.</p><p>Thank you for reading this article and please feel free to comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=458f2753fe9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter — Dart Lists]]></title>
            <link>https://medium.com/@anusha.vijayan.88/flutter-lists-1cd284bca00d?source=rss-3893e0f6e882------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cd284bca00d</guid>
            <dc:creator><![CDATA[Anusha Vijayan ]]></dc:creator>
            <pubDate>Wed, 08 Mar 2023 08:10:51 GMT</pubDate>
            <atom:updated>2023-03-12T06:07:21.855Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Flutter — Dart Lists</strong></p><p>A List is a collection of objects with a length in which each value is assigned an index.</p><p>There are mainly two types of Lists:</p><p><strong>1) Fixed Length List</strong></p><p><strong>2) Growable List</strong></p><p><strong>Fixed Length List:</strong></p><p>· A list in which the length cannot be changed at run time but the values inside the list can be changed.</p><p>· <em>List&lt;String&gt; strList = List&lt;String&gt;.filled(3,’’);</em> ///<strong> a list of length 3 filled with empty string as values</strong></p><p>· <em>‘strList.add()</em>’ ///<strong>will cause an error, as add will attempt to increase the length of the list .</strong></p><p>· <em>List&lt;bool&gt; boolList = List&lt;bool&gt;.filled(5,true); </em>/// <strong>a list of length 5 filled with Boolean value ‘True’ as the default value.</strong></p><p><strong>Growable List:</strong></p><p>· List which are defined with items rather than length, unlike Fixed length list.</p><p>·<em> List&lt;String&gt; strList = &lt;String&gt;[];</em> ///<strong>an empty list</strong></p><p>· <em>List&lt;String&gt; strList = &lt;String&gt;[‘1’,’2’]; </em>///<strong>list with 2 items</strong></p><p><em>strList.add(‘3’)</em>; ///<strong>adding ‘3’ as the last item to the list.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cd284bca00d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>