<?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 Prashant Mishra on Medium]]></title>
        <description><![CDATA[Stories by Prashant Mishra on Medium]]></description>
        <link>https://medium.com/@prashantmishra_1995?source=rss-ff830697147d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*n4jIqQVO_9uR3BZ7NGdBAA.jpeg</url>
            <title>Stories by Prashant Mishra on Medium</title>
            <link>https://medium.com/@prashantmishra_1995?source=rss-ff830697147d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 21:28:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prashantmishra_1995/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[A Comprehensive Guide to the Flutter App Lifecycle]]></title>
            <link>https://medium.com/@prashantmishra_1995/a-comprehensive-guide-to-the-flutter-app-lifecycle-2765328c593c?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2765328c593c</guid>
            <category><![CDATA[flutter-web]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 09:08:52 GMT</pubDate>
            <atom:updated>2024-10-09T09:08:52.361Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Understanding the <strong>Flutter app lifecycle</strong> is crucial for building well-optimized and user-friendly apps. By grasping how an app transitions through different states, you can manage resources efficiently, save data when needed, and ensure your app behaves predictably across various scenarios.</blockquote><p>Let’s explore <strong>Flutter app lifecycle</strong> in detail with an example to learn how to handle lifecycle changes effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*BbbVi-4Gow313wQSiPHL8A.jpeg" /><figcaption><strong>App Lifecycle</strong></figcaption></figure><h3>What is the Flutter App Lifecycle?</h3><p>The <strong>Flutter app lifecycle</strong> refers to the various states that an app goes through during its lifetime. These states include starting, running in the foreground, being paused in the background, and eventually being terminated. Each of these states requires different resource management strategies to ensure smooth performance and data integrity.</p><h3>Why is Lifecycle Management Important?</h3><p>Understanding and properly handling the app lifecycle helps developers to-</p><ul><li><strong>Optimize resource usage</strong>: By pausing resource-heavy tasks like animations when the app is in the background.</li><li><strong>Preserve user data</strong>: Save state information to prevent data loss when the app is suspended or terminated.</li><li><strong>Manage tasks effectively</strong>: Resume or restart tasks like network requests and updates when the app returns to the foreground.</li></ul><h3>Key Lifecycle States in Flutter</h3><p>Flutter apps generally experience the following lifecycle states:</p><h3>1. App Initialization (Start State)</h3><ul><li><strong>Triggered When</strong>: The app starts for the first time.</li><li><strong>Key Tasks</strong>: Set up necessary resources such as services, API connections, or loading configurations.</li><li><strong>Code Example</strong>: The main() function initializes the app.</li></ul><pre>void main() {<br>  runApp(MyApp());<br>}</pre><h3>2. Foreground (Active State)</h3><ul><li><strong>Triggered When</strong>: The app is visible and interacting with the user.</li><li><strong>Key Tasks</strong>: Handle all user interactions, animations, and network requests during this state.</li><li><strong>Lifecycle Method</strong>: When the app is running, no special lifecycle events are triggered since this is the default state.</li></ul><h3>3. Paused (Inactive State)</h3><ul><li><strong>Triggered When</strong>: The app becomes partially or fully obscured (e.g., receiving a phone call or locking the screen).</li><li><strong>Key Tasks</strong>: Pause animations, stop updating the UI, and halt other non-critical tasks.</li><li><strong>Code Hook</strong>: You can monitor this state using AppLifecycleState.inactive.</li></ul><pre>if (state == AppLifecycleState.inactive) {<br>  // Pause animations or other resources<br>}</pre><h3>4. Resumed (Foreground State)</h3><ul><li><strong>Triggered When</strong>: The app returns to the foreground after being paused or backgrounded.</li><li><strong>Key Tasks</strong>: Resume tasks that were paused, such as animations, network requests, or updating the UI.</li><li><strong>Code Hook</strong>: Managed with the AppLifecycleState.resumed method.</li></ul><pre>if (state == AppLifecycleState.resumed) {<br>  // Resume tasks like API calls, timers, or animations<br>}</pre><h3>5. Suspended (Background State)</h3><ul><li><strong>Triggered When</strong>: The app moves to the background, for instance, when the user switches to another app.</li><li><strong>Key Tasks</strong>: Save any important data, release heavy resources like camera or sensors, and pause all unnecessary processes to conserve battery life.</li><li><strong>Lifecycle Method</strong>: Handled using AppLifecycleState.paused.</li></ul><pre>if (state == AppLifecycleState.paused) {<br>  // Save data, close network connections, or stop services<br>}</pre><p><strong>6. Terminated (Stopped State)</strong></p><ul><li><strong>Triggered When</strong>: The app is closed or terminated by the system due to resource constraints.</li><li><strong>Key Tasks</strong>: Save any final data and clean up resources. It’s important to note that Flutter doesn’t provide a direct callback for app termination, unlike Android’s onDestroy().</li></ul><h3>Managing Lifecycle Events in Flutter</h3><p>Flutter provides a way to listen for lifecycle state changes using the WidgetsBindingObserver interface. By implementing this, you can monitor and handle lifecycle events in your app.</p><h3>Complete Flutter Lifecycle Example</h3><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() =&gt; runApp(MyApp());<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;Flutter Lifecycle Demo&#39;,<br>      home: LifecycleDemo(),<br>    );<br>  }<br>}<br><br>class LifecycleDemo extends StatefulWidget {<br>  @override<br>  _LifecycleDemoState createState() =&gt; _LifecycleDemoState();<br>}<br><br>class _LifecycleDemoState extends State&lt;LifecycleDemo&gt; with WidgetsBindingObserver {<br>  String _lifecycleState = &quot;App started&quot;;<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    // Add observer to listen to app lifecycle changes<br>    WidgetsBinding.instance.addObserver(this);<br>    print(&quot;App initialized&quot;);<br>  }<br><br>  @override<br>  void dispose() {<br>    // Remove observer when no longer needed<br>    WidgetsBinding.instance.removeObserver(this);<br>    print(&quot;App disposed&quot;);<br>    super.dispose();<br>  }<br><br>  // This method is called whenever the app&#39;s lifecycle state changes<br>  @override<br>  void didChangeAppLifecycleState(AppLifecycleState state) {<br>    setState(() {<br>      switch (state) {<br>        case AppLifecycleState.inactive:<br>          _lifecycleState = &quot;App is inactive&quot;;<br>          print(&quot;App is inactive&quot;);<br>          break;<br>        case AppLifecycleState.paused:<br>          _lifecycleState = &quot;App is paused&quot;;<br>          print(&quot;App is paused&quot;);<br>          break;<br>        case AppLifecycleState.resumed:<br>          _lifecycleState = &quot;App is resumed&quot;;<br>          print(&quot;App is resumed&quot;);<br>          break;<br>        case AppLifecycleState.detached:<br>          _lifecycleState = &quot;App is detached&quot;;<br>          print(&quot;App is detached&quot;);<br>          break;<br>      }<br>    });<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: Text(&#39;Flutter Lifecycle Demo&#39;)),<br>      body: Center(<br>        child: Text(<br>          _lifecycleState,<br>          style: TextStyle(fontSize: 24),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h3>Key Concepts in the Example:</h3><ul><li><strong>WidgetsBindingObserver</strong>: This class is used to observe and respond to lifecycle events.</li><li><strong>didChangeAppLifecycleState()</strong>: This method gets triggered every time the app transitions between lifecycle states (paused, resumed, inactive).</li><li><strong>setState()</strong>: We use setState() to update the UI when lifecycle state changes.</li></ul><h3>Real-World Use Cases for Lifecycle Management</h3><ul><li><strong>Saving User Data</strong>: Ensure critical data (such as user input or progress in a game) is saved when the app enters the background.</li><li><strong>Managing Network Connections</strong>: Pause network requests when the app is paused to avoid unnecessary data usage or battery drain.</li><li><strong>Optimizing Animations</strong>: Stop animations or other resource-heavy operations when the app is no longer in the foreground to preserve performance.</li></ul><h3>Conclusion</h3><p>Mastering the Flutter app lifecycle allows you to build more efficient and responsive applications. By properly handling transitions between lifecycle states, you can improve performance, preserve data, and create a seamless user experience.</p><p>In this guide, we covered:</p><ul><li>The six key stages of the Flutter app lifecycle.</li><li>How to monitor lifecycle events using WidgetsBindingObserver.</li><li>A complete example that demonstrates how to handle lifecycle changes.</li></ul><p>Understanding these concepts will enable you to build more robust and user-friendly Flutter apps.</p><p>Follow me for more informative articles.</p><blockquote>for any kind of application development services email me at <a href="http://prashantmishra1995@gmail.com/">prashantmishra1995@gmail.com</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2765328c593c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[States of a flutter application]]></title>
            <link>https://medium.com/@prashantmishra_1995/states-of-a-flutter-application-f388a46da93d?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f388a46da93d</guid>
            <category><![CDATA[app-state]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Tue, 23 Aug 2022 15:51:48 GMT</pubDate>
            <atom:updated>2022-08-23T15:51:48.668Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8mO1WGUpWWrGPgvs.png" /></figure><blockquote><strong>Every Application has some states in which it transits time to time based on user activity.</strong></blockquote><p>In this article we can discuss various states of a flutter application and we can also create an application to see them and understand better.</p><blockquote><strong><em>Complete code is at the end of this article but, it is recommended to follow step by step and understand the usage of widgetBindingObserver and its callback.</em></strong></blockquote><p><strong>There are four predefined state enums for handling the modes and states of any flutter application.</strong></p><p>1-Resumed</p><p>2-Paused</p><p>3-Inactive</p><p>4-Detached</p><h3><strong>RESUMED:</strong>-</h3><p>When the application is visible and responding to user input.</p><h3>PAUSED:-</h3><p>When the application is not currently visible to the user, not responding to user input, and running in the background.</p><h3>INACTIVE:-</h3><p>When the application is in an inactive state and is not receiving user input.</p><p><strong>iOS</strong> — when in a phone call.</p><p>responding to a TouchID request.</p><p>when entering the app switcher or the control center.</p><p>or when the UIViewController hosting the Flutter app is transitioning.</p><p><strong>Android</strong> — when another activity is focused, such as</p><p>a split-screen app.</p><p>a phone call.</p><p>a picture-in-picture app.</p><p>a system dialog.</p><p>or another window.</p><p>Apps in this state should assume that they may be <a href="https://api.flutter.dev/flutter/dart-ui/AppLifecycleState.html">paused</a> at any time.</p><h3>DETACHED:-</h3><p>When the application is still hosted on a flutter engine but is detached from any host views.</p><p>When the application is in this state, the engine is running without a view,it can either be in the progress of attaching a view when engine first initializes or after the view being destroyed due to a Navigator pop.</p><blockquote><strong>Resumed</strong> — in foreground | responding to user</blockquote><blockquote><strong>Paused</strong> — not visible | no response | background</blockquote><blockquote><strong>Inactive</strong> — in foreground | no response</blockquote><blockquote><strong>Detached</strong> — not visible | being created/destroyed</blockquote><p><strong>Now we can try to understand it in a better way by replicating all the states through an example</strong></p><p><strong>1- create two variables timer and count.</strong></p><p>late Timer timer;</p><p>int count=0;</p><p><strong>2- make init block for initialising the variables and initialise the timer here.</strong></p><p>@override</p><p>void initState() {</p><p>super.initState();</p><p>timer = Timer.periodic(const Duration(seconds: 1), (timer) {</p><p>});</p><p>}</p><p><strong>3- make dispose block for cancelling and stopping the functions which we need to stop and cancel the timer here.</strong></p><p>@override</p><p>void dispose() {</p><p>super.dispose();</p><p>timer.cancel();</p><p>}</p><p><strong>4-Now we need to add WidgetsBindingObserver observer for using the callbacks provided by this observer to observe the changes in the app states. We can call a mixin WidgetsBindingObserver using with keyword.</strong></p><p>class _MyHomePageState extends State&lt;MyHomePage&gt; with WidgetsBindingObserver</p><p><strong>5- add an observer in the init block</strong></p><p>void initState() {</p><p>super.initState();</p><p>WidgetsBinding.instance.addObserver(this);</p><p>timer = Timer.periodic(const Duration(seconds: 1), (timer) {</p><p>});</p><p>}</p><p><strong>*</strong>We can add the observer using this keyword as the observer name.</p><p><strong>6- Remove the observer in the dispose block.</strong></p><p>@override</p><p>void dispose() {</p><p>super.dispose();</p><p>timer.cancel();</p><p>WidgetsBinding.instance.removeObserver(this);</p><p>}</p><p><strong>7- now we can use the callback didChangeAppLifecycleState</strong></p><p>@override</p><p>void didChangeAppLifecycleState(AppLifecycleState state) {</p><p>super.didChangeAppLifecycleState(state);</p><p>}</p><p><strong>8- We can write the conditions inside the didChangeAppLifecycleState callback for observing the changes and to print them in our console.</strong></p><p>@override</p><p>void didChangeAppLifecycleState(AppLifecycleState state) {</p><p>super.didChangeAppLifecycleState(state);</p><p>if (state == AppLifecycleState.resumed) {</p><p>print(‘RESUMED’);</p><p>} else if (state == AppLifecycleState.inactive) {</p><p>print(‘INACTIVE’);</p><p>} else if (state == AppLifecycleState.detached) {</p><p>print(‘DETACHED’);</p><p>} else if (state == AppLifecycleState.paused) {</p><p>print(‘PAUSED’);</p><p>}</p><p>}</p><p><strong>9- now we can use Text and print the count on app screen .</strong></p><p><strong>10- then we need to stop the timer when the application goes in background i.e, paused state and resume it again when it goes to resumed state.</strong></p><p><strong>Once the bool active is defined we can use it wherever we need to stop it and resume it.</strong></p><p><strong>By using the full code snippet shared here you can observe and understand the changes in the application states.</strong></p><p><strong>FULL CODE</strong></p><p>import ‘dart:async’;</p><p>import ‘package:flutter/material.dart’;</p><p>void main() {</p><p>runApp(const MyApp());</p><p>}</p><p>class MyApp extends StatelessWidget {</p><p>const MyApp({Key? key}) : super(key: key);</p><p>@override</p><p>Widget build(BuildContext context) {</p><p>return MaterialApp(</p><p>title: ‘Flutter Demo’,</p><p>theme: ThemeData(</p><p>primarySwatch: Colors.blue,</p><p>),</p><p>home: const MyHomePage(title: ‘Flutter Demo Home Page’),</p><p>);</p><p>}</p><p>}</p><p>class MyHomePage extends StatefulWidget {</p><p>const MyHomePage({Key? key, required this.title}) : super(key: key);</p><p>final String title;</p><p>@override</p><p>State&lt;MyHomePage&gt; createState() =&gt; _MyHomePageState();</p><p>}</p><p>class _MyHomePageState extends State&lt;MyHomePage&gt; with WidgetsBindingObserver {</p><p>late Timer timer;</p><p>int count = 0;</p><p>bool active = true;</p><p>@override</p><p>void initState() {</p><p>super.initState();</p><p>WidgetsBinding.instance.addObserver(this);</p><p>timer = Timer.periodic(const Duration(seconds: 1), (timer) {</p><p>if (active) {</p><p>setState(() {</p><p>count += 1;</p><p>});</p><p>}</p><p>});</p><p>}</p><p>@override</p><p>void dispose() {</p><p>super.dispose();</p><p>timer.cancel();</p><p>WidgetsBinding.instance.removeObserver(this);</p><p>}</p><p>@override</p><p>void didChangeAppLifecycleState(AppLifecycleState state) {</p><p>super.didChangeAppLifecycleState(state);</p><p>if (state == AppLifecycleState.resumed) {</p><p>active = true;</p><p>print(‘RESUMED’);</p><p>} else if (state == AppLifecycleState.inactive) {</p><p>active = false;</p><p>print(‘INACTIVE’);</p><p>} else if (state == AppLifecycleState.detached) {</p><p>print(‘DETACHED’);</p><p>} else if (state == AppLifecycleState.paused) {</p><p>active = false;</p><p>print(‘PAUSED’);</p><p>}</p><p>}</p><p>@override</p><p>Widget build(BuildContext context) {</p><p>return Scaffold(</p><p>appBar: AppBar(</p><p>title: Text(widget.title),</p><p>),</p><p>body: Center(</p><p>child: Column(</p><p>mainAxisAlignment: MainAxisAlignment.center,</p><p>children: &lt;Widget&gt;[</p><p>Text(</p><p>count.toString(),</p><p>style: const TextStyle(fontSize: 20),</p><p>),</p><p>],</p><p>),</p><p>),</p><p>);</p><p>}</p><p>}</p><p>@override</p><p>void didChangeAppLifecycleState(AppLifecycleState state) {</p><p>super.didChangeAppLifecycleState(state);</p><p>if(state == AppLifecycleState.resumed){</p><p>active=true;</p><p>print(‘RESUMED’);</p><p>} else if (state == AppLifecycleState.inactive){</p><p>active=false;</p><p>print(‘INACTIVE’);</p><p>} else if(state == AppLifecycleState.detached){</p><p>print(‘DETACHED’);</p><p>} else if(state==AppLifecycleState.paused){</p><p>active=false;</p><p>print(‘PAUSED’);</p><p>}</p><p>}</p><p>Thanks for reading this article, you can connect with me on <strong><em>prashantmishra1995@gmail.com</em></strong></p><p>follow me on <a href="http://www.linkedin.com/in/prashant-mishra-402771107">linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f388a46da93d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[void main() in dart]]></title>
            <link>https://medium.com/@prashantmishra_1995/why-do-we-use-void-main-in-dart-781ff50402ff?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/781ff50402ff</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[function]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Sun, 21 Aug 2022 12:26:32 GMT</pubDate>
            <atom:updated>2022-08-23T12:00:25.937Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong><em>We use void main() as the entry point for every dart application and its recommended in the dart script too.</em></strong></h4><p><strong>But, most of us never try to find out the reason behind it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wNI_6v7vuS7J8qD4Qq9deQ.png" /></figure><p>We all know about the necessity of using void main() in every dart application for its execution and it is the entry point. I am also using it since my very first date with dart and it did not bother me too. I read in the documentation about its usage and started writing void main() as the first line of my application. One day i was sitting idle and all of a sudden a question came to my mind,</p><p><strong><em>What if we don’t use void main() or instead of using void why don’t we use main() only ?</em></strong></p><p>After pondering into the official documentation, the articles provided on internet, stack overflow answers, the youtube videos and after putting some of my brain i got the answer and now i thought of discussing it with you here.</p><p><strong><em>Points for discussion:</em></strong></p><p><strong><em>1- main() function</em></strong></p><p><strong><em>2- return type</em></strong></p><p><strong><em>3- void main() function</em></strong></p><p><strong><em>4- why void main(), why not something else?</em></strong></p><h3><strong>main() function:</strong></h3><p>main() function is a predefined function provided by dart script. It is used as the entry point for any application written in dart.</p><p>It is already defined in the dart’s script and whenever we try to execute any program or application, it searches for main() and then it executes the code written inside it.</p><blockquote><strong>If we try to execute any dart program without main() function it will not execute and throws an error.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vi5R4CcEdXPke5EMTD5bTA.png" /></figure><blockquote><strong>when we compile it with main() function, it compiles without any error.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y29Fz0ucZhydFRI_ptIGPw.jpeg" /></figure><h3><strong>return type :</strong></h3><p>It is recommended to declare return type for the dart functions because every function in dart returns a value and if we do not declare it, it returns null by default.</p><blockquote><strong>we can not use the value returned by void functions in dart</strong>. <strong>dart does not allow us to do so.</strong></blockquote><p><strong>let’s see the change in return type with and without void-</strong></p><p>1-<strong>With void as the return type</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vpTK3qleieBeC1h8Ev5kQA.jpeg" /><figcaption><strong>With void</strong></figcaption></figure><p><strong>2-Without void as the return type</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wsrdq4ak_H81rtCtLPmi2Q.jpeg" /><figcaption><strong>Without void</strong></figcaption></figure><h3><strong>void main() function:</strong></h3><p>the function called to execute the code is required to run only for a single time because if the code is already executed why can we try to execute it again.</p><p>By keeping this in mind void return type is used here because it needs to run for one time only(at the time of execution) and it is also not required to return any value that’s why void is used here as the entry point.</p><blockquote><strong><em>Every app can go to the entry point only once in its lifetime.</em></strong></blockquote><blockquote><strong>Note: before the release of dart 2 Function&lt;void&gt; was used but from dart 2 it changed to void main().</strong></blockquote><h3><strong><em>why void main(), why not something else?</em></strong></h3><p>I think, we got the answer for this question after discussing the above points. and now we got the reason behind the usage of void as the return type specifically.</p><p>Thanks, for reading this article and in case of any confusion or if you want to add some more points here then you can comment or contact me. i am open to gain more knowledge.</p><p>Follow me for more articles.</p><p>contact me at <strong><em>prashantmishra1995@gmail.com</em></strong></p><p>Follow me on <a href="https://www.linkedin.com/in/prashant-mishra-402771107/">linkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=781ff50402ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dart Platforms]]></title>
            <link>https://medium.com/@prashantmishra_1995/dart-platforms-e20ad39279c0?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e20ad39279c0</guid>
            <category><![CDATA[hybrid-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Tue, 24 May 2022 07:16:22 GMT</pubDate>
            <atom:updated>2022-05-24T07:16:22.357Z</atom:updated>
            <content:encoded><![CDATA[<h4>Strong fundamentals leads to perfect execution</h4><p><strong>Agenda: </strong><em>To understand dart’s execution mechanism across platforms.</em></p><p>Hybrid concept is very much popular these days because of its tremendous capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*OczGfrgX5XsNUefhMuvOhg.png" /></figure><p>Dart supports almost all the platforms and its not going to stop here only it is evolving day by day.</p><p>I will break it down in two parts.</p><p><strong>1-Native Platforms</strong></p><p><strong>2-Web Platforms</strong></p><h3>Native Platforms</h3><p>It acquires <strong>Mobile</strong> and <strong>Desktop</strong> applications.</p><p>it has DartVM and AOT(ahead of time) compiler.</p><p>it does JIT(just in time) compilation.</p><p>For compilation it supports-</p><h4><strong>ARM32</strong></h4><h4><strong>ARM64</strong></h4><h3><strong>Web Platforms</strong></h3><p>for web platforms it supports two type of compilers.</p><p>1- Development time compiler(dartdevc)</p><p>2- Production time compiler(dart2js)</p><ul><li><strong>Both of them translate dart into javascript.</strong></li></ul><p>For compilation it supports</p><h4><strong>x86_64</strong></h4><h4><strong>JavaScript</strong></h4><h3>Dart Runtime</h3><p>It is required for code execution.</p><p>it performs</p><p>1- <strong>Memory Management — </strong>The unused memory is reclaimed by GC(Garbage Collector).</p><p><strong>2-Enforcing the dart type —</strong> Static(compile time) &amp; Dynamic(run time).</p><p><strong>3-Isolates Management — </strong>it handles the main isolates(where code runs) and the isolates created by App.</p><p><strong>Note- On native platforms, the Dart runtime is automatically included inside self-contained executables, and is part of the Dart VM provided by the </strong><a href="https://dart.dev/tools/dart-run"><strong>dart run</strong></a><strong> command.</strong></p><p>You can also follow the official <a href="https://dart.dev/overview#platform">documentation</a>.</p><p>Thank you so much! for reading this article.</p><p><a href="https://medium.com/@prashantmishra_1995">Follow me for more articles</a>.</p><p>contact me at <strong><em>prashantmishra1995@gmail.com</em></strong></p><p>Follow me at <a href="https://www.linkedin.com/in/prashant-mishra-402771107/">linkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e20ad39279c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter 3.0]]></title>
            <link>https://medium.com/@prashantmishra_1995/flutter-3-0-8e1c4273e09a?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e1c4273e09a</guid>
            <category><![CDATA[hybrid-app-development]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Mon, 23 May 2022 06:10:47 GMT</pubDate>
            <atom:updated>2022-05-23T06:10:47.988Z</atom:updated>
            <content:encoded><![CDATA[<p>“Taking one step at a time is the key to Success…..”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VE0XBnHygXkUA6Nb2-PWnA.jpeg" /></figure><h3><strong>Agenda of this article:</strong></h3><p>In this article i am writing about-</p><p><strong>1-</strong>flutter’s capability.</p><p><strong>2-</strong>What do we get in flutter 3.0?</p><p><strong>3- </strong>How to Migrate?</p><h4><strong>Flutter’s capability</strong></h4><p><em>Flutter is a revolution</em> in itself as it changed the dynamics and mindset of the sources and the resources both.</p><p>The <strong>sources</strong> are now switching to flutter because of its portability and maintainability.</p><p>The <strong>resources</strong> are inclined towards it because of its easy to implement, the language used(DART) is quite similar to other object oriented languages like Java, Python etc, it has a huge collection of libraries &amp; the community is great.</p><h4>What do we get in flutter 3.0?</h4><p>macOS support</p><p>Simplified release model for ios.</p><p>Linux apps support</p><p>Foldable device support</p><p>Improved desktop accesibility.</p><p>Flutter games support using games_services</p><p>Material 3 Widgets and many more……..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSpgnmj9sPk1zBUKpucVCg.jpeg" /></figure><h4>How to Migrate?</h4><p><strong>To Upgrade your already existing version Follow these steps or scroll down to install fresh sdk.</strong></p><p>1- go in terminal and run <strong>flutter — version</strong> to check the currently installed version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hmXf7Pb3I6fmn0bQI-3YGQ.png" /></figure><p>2- run <strong>flutter upgrade</strong> and the upgrade process will start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHQLemMkHwwLObKw4H_34A.png" /></figure><p>3-Once the download is completed it will automatically run <strong>flutter doctor</strong> and show the status <strong>No issue found</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAii0SzPb_NbczTW02tF9g.png" /></figure><blockquote><strong>Voila its upgraded to flutter 3.0 now. restart your IDE and enjoy.</strong></blockquote><h4>To install it fresh</h4><p>1- go to flutter.dev and choose the platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMgqhH0iUVS6X1wQrAVG_A.png" /></figure><p>2-choose the platform and download the zip file or follow the instructions provided there for getting it from remote channel.</p><p><strong>Note:-</strong> two zip files are available in case of macOS based on your machine(intel or apple silicon).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VmUIcYEv6lLdjJqyoeWSbw.png" /></figure><p>3- Once the file is downloaded extract it and store its path as environment variable.</p><p>Then open the IDE and run flutter pub get everything will be in sync now.</p><p><strong>Note:-</strong> run <strong>flutter doctor</strong> to know the status or <strong>flutter — version</strong> to know the version.</p><blockquote><strong>Congrats now your flutter is upgraded to latest version</strong></blockquote><p>You can also follow the official <a href="https://docs.flutter.dev/get-started/install">documentation</a>.</p><p>Thank you so much! for reading this article.</p><p>Follow me for more articles.</p><p>contact me at <strong><em>prashantmishra1995@gmail.com</em></strong></p><p>Follow me at <a href="https://www.linkedin.com/in/prashant-mishra-402771107/">linkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e1c4273e09a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Unit Testing]]></title>
            <link>https://medium.com/@prashantmishra_1995/flutter-unit-testing-f8ffe632c83b?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8ffe632c83b</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[flutter-test]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Sat, 16 Apr 2022 08:47:23 GMT</pubDate>
            <atom:updated>2022-04-23T11:47:33.985Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>“testing our knowledge before execution makes us more confident”</strong></p><p><strong>NOTE : </strong>Writing test case is as important as writing the core code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2OBmb1hU2F3TV2l1aZcZnw.jpeg" /></figure><p><strong>What is Testing?</strong></p><p>A Code written to automatically validate other code.</p><p><strong>Why do we need testing?</strong></p><p>Sometimes when we have more features in our app, it becomes harder and even time consuming to test it manually. To overcome this issue automated testing helps a lot and it makes sure that our app is performing correctly, that’s why it becomes important to perform automated testing before publishing it.</p><p><strong>How many types of testing we generally have?</strong></p><p>Generally testing is categorized in many categories based on its purpose and characteristics:</p><p><strong>1- Unit Testing</strong></p><p>“Unit testing is the most important and the most popular testing methodology followed till date.”</p><p>It is mainly written to test a single function, method or a class.</p><p>it has less dependency, fast execution and high priority.</p><p><strong>2- Integration Testing</strong></p><p>It is mainly written to test the complete app or larger part/module of it.</p><p>it has most dependency, slow execution and medium priority.</p><p><strong>3- Widget Testing</strong></p><p>It is written to test a single widget.</p><p>it has more dependency, fast execution and less priority.</p><p><strong>Unit Testing &gt; Integration Testing &gt; Widget Testing</strong> (On basis of usage)</p><h3>How to perform unit test in flutter?</h3><p><strong>Note: </strong>flutter has<strong> flutter_test </strong>dependency in<strong> dev_dependencies </strong>inside <strong>pubspec.yaml</strong> file for testing. It also has <strong>test </strong>directory, which is below the <strong>lib</strong> directory and by default it has a dart file named as <strong>widget_test.dart</strong> in which widget testing code is written.</p><p><strong>pubspec.yaml file</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*VAzElWnwBrRYiEvNe46HSA.png" /></figure><p><strong>Follow these mendatory steps:</strong></p><p><strong>step 1: </strong>The classes and dart files to be tested can be kept inside lib directory and the test codes can be written inside the test directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*6JYrYRYx3oMadKfUKmNDgw.png" /></figure><p><strong>step 2: </strong>The test files must end with <strong>test.dart</strong> as the command flutter test searches for the files following this naming convention. <strong>ex: feature_test.dart</strong></p><p><strong>step 3: </strong>Inside the test.dart file import package flutter_test</p><pre><strong>import &#39;package:flutter_test/flutter_test.dart&#39;</strong>;</pre><p><strong>step 4:</strong> Now create void main() and inside main function write the testing code.</p><p><strong>Note: Follow the example carefully for better understanding.</strong></p><p><strong>create a class Calculator.dart inside lib</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qECdXPggm2CpYXCqtrVrhQ.png" /></figure><p><strong>create a file calculator_test.dart inside test directory.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHT-ccv-5xcvhgDJsIF1Wg.png" /></figure><p><strong>now write the test cases inside the body of test function.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*GPLr5B47L49MJs9SmaQp4A.png" /></figure><p><strong>Now click the green button beside the main function to run the test.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6h3o246yBRlfWkKdWZ1KQ.png" /></figure><p><strong>Or open terminal and write the command flutter test &lt;test file relative path&gt; and press enter</strong></p><p>E:\unit_testing&gt; flutter test test/calculator_test.dart</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*8g6YmrbO9uoXpZ6Kj4goYw.png" /></figure><p><strong>If the input is wrong and the test case fails, we get the error message</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yA74-nbKWUaOCspLjtRyMg.png" /></figure><p><strong>Similarly we can write test cases for more then one function too.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yC78ElKRjQqljf-tdYMBDw.png" /></figure><p><strong>But the better way is to use group() function inside the main() function in such conditions.</strong></p><pre>group(<strong>&#39;description&#39;</strong>, (){});//description, body</pre><p><strong>Now, put all the test cases inside the group() function, by doing this we can run all the test cases written inside the group together.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OayAUymmYgaXq4Fdqq7LaA.png" /></figure><p><strong>Note: Similarly we can write test cases for rest of the functions too.</strong></p><p><strong>So, write the test cases for the remaining functions of Calculator class and run it with different inputs and check whether it passes or not.</strong></p><p>Advanced version will be published in next chapter.</p><p><strong><em>To Be Continued……..</em></strong></p><p>Thankyou so much! for reading this article.</p><p><a href="https://medium.com/@prashantmishra_1995"><strong><em>Follow</em></strong></a><strong><em> me for more </em></strong><a href="https://medium.com/@prashantmishra_1995"><strong><em>articles</em></strong></a><strong><em> and guidelines.</em></strong></p><p><a href="https://www.linkedin.com/in/prashant-mishra-402771107/"><strong><em>Follow</em></strong></a><strong><em> me at </em></strong><a href="https://www.linkedin.com/in/prashant-mishra-402771107/"><strong><em>linkedin</em></strong></a></p><p><a href="https://medium.com/@prashantmishra_1995/how-to-be-a-good-flutter-developer-752b1ebdadb5">https://medium.com/@prashantmishra_1995/how-to-be-a-good-flutter-developer-752b1ebdadb5</a></p><p>contact me at <strong><em>prashantmishra1995@gmail.com</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8ffe632c83b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Provider in flutter]]></title>
            <link>https://medium.com/@prashantmishra_1995/how-to-use-provider-in-flutter-25c4df8ed2c9?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/25c4df8ed2c9</guid>
            <category><![CDATA[provider]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[state-management]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Thu, 16 Dec 2021 11:22:53 GMT</pubDate>
            <atom:updated>2021-12-19T18:07:56.200Z</atom:updated>
            <content:encoded><![CDATA[<p>provider is on of the most used and liked packages available in flutter. it is endorsed by flutter community itself.</p><p>provider can be used for Dependency Injection(dI) as well as for State Management. Though we can use setState() too for managing the states but setState() is not the optimized solution for it. so, it is recommended to use provider to handle and lift the states up in flutter applications.</p><p>Now, we can see how provider can be used by applying it to the counter application.</p><blockquote><em>follow the screenshots to understand better. you can also get the code from link provided at the bottom.</em></blockquote><p><strong>Please follow these steps:-</strong></p><p>go to pubspec.yaml, add the provider dependency and run flutter pub get or click the text Pub get available at top right of the screen to get the dependency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2F14xklLHkid-soSY9YDw.png" /></figure><p>Once the dependency is added create a new dart file counter.dart in lib. create a class to hold the counter value. use it as a mixin using with keyword or extend it with ChangeNotifier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSyX1NNXi0IA8UXQRM4UVQ.png" /></figure><p>Now, we need to insert parent provider to our widget for that go to main.dart and wrap MyHomePage() inside ChangeNotifierProvider&lt;Counter&gt;(), call the create argument inside it and call Counter().</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mm0rqTjGH3Fg2L3NAzoXFg.png" /></figure><p>Go inside MyHomePage(), define a variable and call the provider.</p><p>final counter=Provider.<em>of</em>&lt;Counter&gt;(context);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zo7wwcYHA2xwQXm5QG4NOw.png" /></figure><p>now we need to add a consumer to consume the data when the state is lifted.wrap the Text widget inside Consumer widget. consumer requires three parameters consumer, child and data.</p><p>use counter.increement in floating button’s onPressed and to show the counter text use counter.value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5CW6k6XtzEM_HDs8yA1uTA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25c4df8ed2c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to be a good FLUTTER developer?]]></title>
            <link>https://medium.com/@prashantmishra_1995/how-to-be-a-good-flutter-developer-752b1ebdadb5?source=rss-ff830697147d------2</link>
            <guid isPermaLink="false">https://medium.com/p/752b1ebdadb5</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Prashant Mishra]]></dc:creator>
            <pubDate>Sun, 08 Aug 2021 17:59:51 GMT</pubDate>
            <atom:updated>2022-04-16T15:17:24.951Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>To be an expert you need to be a good OBSERVER.</strong></blockquote><p>Hello Everyone! its great to know you are reading this article. In this article, you will learn “<strong>what to do and and what not</strong>” to be a good <em>flutter</em> developer. I am a experienced flutter developer and its not difficult to be a mobile developer in present era but it is definitely difficult to become a good mobile developer. I am here to share my experience with you.</p><h3><strong>What to do?</strong></h3><p><strong>1-</strong> read the official flutter documentation its too good but don’t expect to understand everything in one go. <em>click here</em> for flutter official documentation.</p><p><strong>2- </strong>follow the codelab for flutter provided by google. <a href="https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1?hl=en&amp;continue=https%3A%2F%2Fcodelabs.developers.google.com%2F#0">click here</a> for flutter codelabs.</p><p><strong>3- </strong>start creating simple UIs. You can follow youtube videos for clone apps and designs.</p><p><strong>4-</strong> once you feel comfortable search the designs on dribble or any other source and try to develop the UI in flutter.</p><p><strong>5*-</strong> always try to upload your work on github. By following this practice you will refer your work later and if you are a beginner you can use it to showcase for your job placements.</p><h3>What not to do?</h3><p><strong>1-</strong> Don’t directly start your journey without spending some time with the <a href="https://flutter.dev/docs">official documentation</a>. it will definitely help you and save your time later.</p><p><strong>2- </strong>Don’t just try copy pasting the code from stackoverflow. You can refer it but try reading the code before copying it.</p><p>The only way of learning it is practice.</p><blockquote><strong>Trust me flutter is very cute and interesting.</strong></blockquote><p>Thankyou so much! for reading this article.</p><p>Follow me for articles.</p><p>contact me at <strong><em>prashantmishra1995@gmail.com</em></strong></p><p>Follow me at <a href="https://www.linkedin.com/in/prashant-mishra-402771107/">linkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=752b1ebdadb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>