<?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 Utkarsh Sharma on Medium]]></title>
        <description><![CDATA[Stories by Utkarsh Sharma on Medium]]></description>
        <link>https://medium.com/@utkarsh_46351?source=rss-2d2c534d5280------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*voo_H5jVZsfKDWAA.jpg</url>
            <title>Stories by Utkarsh Sharma on Medium</title>
            <link>https://medium.com/@utkarsh_46351?source=rss-2d2c534d5280------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 20:54:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@utkarsh_46351/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[Custom Shared Preferences In Flutter]]></title>
            <link>https://medium.flutterdevs.com/custom-shared-preferences-in-flutter-e8b07ba2b0f0?source=rss-2d2c534d5280------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8b07ba2b0f0</guid>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[sharedpreferences]]></category>
            <dc:creator><![CDATA[Utkarsh Sharma]]></dc:creator>
            <pubDate>Mon, 31 Aug 2020 02:21:01 GMT</pubDate>
            <atom:updated>2024-06-12T08:01:07.681Z</atom:updated>
            <content:encoded><![CDATA[<h4>Create your own Temporary/Persistent storage using plain dart</h4><figure><a href="https://flutterexperts.com/custom-shared-preferences-in-flutter/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2m8mlZ4v1iF9g586yTx3w.png" /></a></figure><p>This article will walk you through the basics of file I/O and in the end, You will be able to build your own storage service just like shared preference using Dart: <strong>IO library.</strong></p><blockquote>For Complete Project Checkout :</blockquote><p><a href="https://github.com/flutter-devs/own-shared-preferences.git">flutter-devs/own-shared-preferences</a></p><p>Our main aim is to dig deep into Flutter file I/O so for that, we are creating our own shared preferences just to learn the basics of file I/O.</p><p><strong>Shared preferences</strong> in flutter allow the developer to store some sort of state weather it’s related to user data like the day-night theme or some app-level data which we want to persist even after closing the app.</p><blockquote><strong>Let&#39;s start by jumping straight into our Database Code for Complete Code along with UI checkout the above git repository.</strong></blockquote><pre>import &#39;dart:io&#39;;<br>import &#39;dart:convert&#39;;<br>import &#39;package:path_provider/path_provider.dart&#39;;<br><br>class CoreDb {<br>  //Creating singleton of CoreDb<br>  CoreDb._();<br>  static CoreDb <em>_obj</em>;<br>  static <em>instance</em>() {<br>    if (<em>_obj </em>== null) <em>_obj </em>= CoreDb._();<br>    return <em>_obj</em>;<br>  }</pre><pre>//Getting document path using path provider package<br>Future&lt;String&gt; get _localPath async {<br>  final directory =<br>      await getApplicationDocumentsDirectory();<br>  return directory.path;<br>}</pre><pre>//getting instance of file using localPath<br>Future&lt;File&gt; get _localFile async {<br>  final path = await _localPath;<br>  return File(&#39;$path/preference.json&#39;); <br>}</pre><pre>//function to write data in file <br>void writeData(Map data) async {<br>  File file = await _localFile;<br>  Map&lt;String, dynamic&gt; tempMap; <br><br>  if (await file.exists()) {<br>    tempMap = json.decode(<br>        file.readAsStringSync()); <br>    tempMap.addAll(data); <br>    file.writeAsStringSync(json.encode(<br>        tempMap));<br>  } else {<br>    file.writeAsStringSync(<br>        json.encode(data));<br>  }<br>}</pre><pre>//Function to get all the data in json format<br>Future&lt;Map&gt; getData({String key}) async {<br>  File tempFile = await _localFile;<br>  if (await tempFile.exists()) {<br>    return json.decode(tempFile.readAsStringSync()); <br>  } else<br>    return null;<br>}</pre><pre>//To delete data if exist in the file<br>Future deleteData(<br>      String dataToDelete, Function onDelte, Function ifNotExist) async {<br>    File tempFile = await _localFile;<br>    if (!tempFile.existsSync()) {<br>      ifNotExist(); <br>    } else {<br>      Map data = json.decode(tempFile.readAsStringSync());<br>      var result = data.remove(dataToDelete);<br>      if (result == null) {<br>        ifNotExist(); <br>      } else {<br>        tempFile.writeAsStringSync(json.encode(data));<br>        onDelte();<br>      }<br>    }<br>  }<br>}</pre><p>In the above code we are Interacting with files on our device using dart.io library the above code replicates the same functionality of shared Preferences.</p><h4>Note: You can read the full blog <a href="https://flutterexperts.com/custom-shared-preferences-in-flutter/">here</a>.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8b07ba2b0f0" width="1" height="1" alt=""><hr><p><a href="https://medium.flutterdevs.com/custom-shared-preferences-in-flutter-e8b07ba2b0f0">Custom Shared Preferences In Flutter</a> was originally published in <a href="https://medium.flutterdevs.com/">FlutterDevs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Performance Optimization]]></title>
            <link>https://medium.flutterdevs.com/flutter-performance-optimization-17c99bb31553?source=rss-2d2c534d5280------2</link>
            <guid isPermaLink="false">https://medium.com/p/17c99bb31553</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Utkarsh Sharma]]></dc:creator>
            <pubDate>Sat, 22 Aug 2020 02:11:01 GMT</pubDate>
            <atom:updated>2024-06-13T06:23:56.023Z</atom:updated>
            <content:encoded><![CDATA[<h4>Know all about async/await , Isolate, Thread &amp; Event Loops</h4><figure><a href="https://flutterexperts.com/flutter-performance-optimization/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ywoHZmHv4FvVTW0DY_LNyg.png" /></a></figure><p>Ever wondered how flutter handles all your UI building and events like Futures, taps, etc.. on a single thread( yes it does all that on a single thread 😮😮😮 until and unless explicitly done).</p><h3>What is Thread/Isolates ?</h3><p>Thread is an independent process that has its own chunk of memory and executes the given instructions on that memory , It can work parallelly with other threads hence can reduce execution time of multiple process on a single thread .</p><blockquote><strong>Let’s understand this with an example :</strong></blockquote><p>In Fps games like counter strike, Call of duty, etc. you can see that as soon as you fire a weapon few tasks executes simultaneously like playing of bullet sound, change of bullet count and reduction in opponent health , All these things happens parallelly these are basically threads which execute parallelly and execute their task on separate isolates(isolates and threads can be used interchangeably as isolate is a Dart way of multi threading more on that below) which have its own memory.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUA7bjWIYpOtc4IWyY%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fgameloft-fps-mcv-xUA7bjWIYpOtc4IWyY&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FxUA7bjWIYpOtc4IWyY%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="233" frameborder="0" scrolling="no"><a href="https://medium.com/media/b88adddb08acc6df43b19457579dbe45/href">https://medium.com/media/b88adddb08acc6df43b19457579dbe45/href</a></iframe><p>Languages like JAVA and C++ Share Their <a href="https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/garbage_collect.html">heap</a> memory with threads, but in case of flutter, every isolate has its own memory and works independently. As it has its own private space this memory doesn’t require locking, as if a thread finishes its task it already means that the thread has finished utilizing its memory space and then that memory can go for garbage collection.</p><blockquote>To maintain these benefits flutter has a separate memory for every isolate(Flutter way of multi-threading) that’s why they are called<strong> isolate 🙂.</strong></blockquote><h4>Note: You can read the full blog <a href="https://flutterexperts.com/flutter-performance-optimization/">here</a>.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17c99bb31553" width="1" height="1" alt=""><hr><p><a href="https://medium.flutterdevs.com/flutter-performance-optimization-17c99bb31553">Flutter Performance Optimization</a> was originally published in <a href="https://medium.flutterdevs.com/">FlutterDevs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>