<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Francisco Souza</title>
    <description>The latest articles on DEV Community by Francisco Souza (@francisceioseph).</description>
    <link>https://dev.to/francisceioseph</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F347273%2F544387b2-b176-4de9-bfa8-def30154c962.png</url>
      <title>DEV Community: Francisco Souza</title>
      <link>https://dev.to/francisceioseph</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/francisceioseph"/>
    <language>en</language>
    <item>
      <title>Flutter Widgets 101</title>
      <dc:creator>Francisco Souza</dc:creator>
      <pubDate>Wed, 18 Mar 2020 16:53:20 +0000</pubDate>
      <link>https://dev.to/francisceioseph/flutter-widgets-15fn</link>
      <guid>https://dev.to/francisceioseph/flutter-widgets-15fn</guid>
      <description>&lt;p&gt;Flutter is a UI toolkit created by Google intended to help developers to easily create pixel-perfect apps for Android and iOS from a single code base. &lt;/p&gt;

&lt;p&gt;No one can deny that the React philosophy inspired the creators of Flutter, and the concept of component, or widget, is central for understanding how applications are designed and build.  Each one is part of a component tree and receives its data from a parent widget. Also, a widget describes its look based on the application's state. Therefore, if data changes, the framework will determine the affected widgets and repaint them accordingly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Example
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;runApp&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Center&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Hello, dev.to'&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
        &lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="o"&gt;),&lt;/span&gt;
    &lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As shown by the example above, each Flutter app requires the package &lt;code&gt;'package:flutter/material.dart'&lt;/code&gt;, which contains all functions needed for the app creation. Next, the &lt;code&gt;runApp&lt;/code&gt; function sets up the initial settings for the app and defines which is the root widget of the application. Finally, the framework forces the root widget to cover all the screen, so, when executed, the example will show a text widget centered into a blank canvas.&lt;/p&gt;

&lt;p&gt;As React programmers know well, flutters components are classified into two types: stateless and stateful widgets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stateless Widget
&lt;/h2&gt;

&lt;p&gt;It is a type of widget that does not require an inner state to render its child tree. Therefore, the parent widget is the source of all data required by the stateless rendering loop.&lt;/p&gt;

&lt;p&gt;To create a stateless widget, the developer must extend the StatelessWidget class and implement the build method. This method is the one responsible for creating the widget's children based on the input data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BackgroundTitle&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;StatelessWidget&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;titleText&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;Color&lt;/span&gt; &lt;span class="n"&gt;backgroundColor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;

  &lt;span class="n"&gt;BackgroundTitle&lt;/span&gt;&lt;span class="o"&gt;({&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;titleText&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;  
  &lt;span class="o"&gt;});&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;padding:&lt;/span&gt; &lt;span class="n"&gt;EdgeInsets&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;all&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;titleText&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;Theme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;primaryTextTheme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;copyWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
              &lt;span class="nl"&gt;fontSize:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
              &lt;span class="nl"&gt;fontWeight:&lt;/span&gt; &lt;span class="n"&gt;FontWeight&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;w600&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;decoration:&lt;/span&gt; &lt;span class="n"&gt;BoxDecoration&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;color:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;withOpacity&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
        &lt;span class="nl"&gt;borderRadius:&lt;/span&gt; &lt;span class="n"&gt;BorderRadius&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;all&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
          &lt;span class="n"&gt;Radius&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;circular&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
        &lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="o"&gt;),&lt;/span&gt;
    &lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Performance
&lt;/h3&gt;

&lt;p&gt;A stateless widget depends solely on the configuration data provided to it. Consequently, the widget is rendered in two main occasions: when the widget is inserted into a widget tree and when that configuration data changes. &lt;/p&gt;

&lt;p&gt;If the parent widget is constantly changing the widget configuration's data, so measures must be taken to avoid performance issues. The developer must guarantee that the widget will continue to render smoothly.&lt;/p&gt;

&lt;p&gt;According to Google's documentation, there are several techniques to be considered to make a widget renders well.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;const&lt;/code&gt; widgets where possible, and provide a &lt;code&gt;const&lt;/code&gt; constructor for a custom widget, too. So, users can apply this same method to the custom widget.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Consider refactoring the stateless widget into a stateful widget, and applying the adequated performance methods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Minimize the use o transient widgets to build complex layouts. Instead of many levels o widget layering, consider using a &lt;code&gt;SinglePaint&lt;/code&gt; widget.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more information about stateless widget, check the &lt;a href="https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stateful Widgets
&lt;/h2&gt;

&lt;p&gt;It is a type of widget that owns an inner and mutable state. As in React, state data can be read synchronously and might change through time. Consequently, stateful widgets are responsible for implementing their inner state, notifying the framework about state changes. &lt;/p&gt;

&lt;p&gt;A stateful widget instance is itself immutable, but its mutable part is stored apart, into state objects. When the widget is created, it subscribes to the state objects and repaints the widget elements according to changes notified by State.setState function.&lt;/p&gt;

&lt;p&gt;Finally, a stateful widget can keep the same state data if moved from one location to another one inside the component tree. But, this behavior is only possible if the developer provides a global key to that widget. Therefore, the framework can track the associated subtree and graft it in another widget tree.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:my_app/src/widgets/components/email_field.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:my_app/src/widgets/components/password_field.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:my_app/src/widgets/components/submit_button.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LoginForm&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;StatefulWidget&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;_LoginFormState&lt;/span&gt; &lt;span class="n"&gt;createState&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_LoginFormState&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;_LoginFormState&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;LoginForm&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;_formKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GlobalKey&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;FormState&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&lt;/span&gt;

  &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;_email&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;_password&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;padding:&lt;/span&gt; &lt;span class="n"&gt;EdgeInsets&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;all&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Center&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Form&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;key:&lt;/span&gt; &lt;span class="n"&gt;_formKey&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
          &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Column&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
            &lt;span class="nl"&gt;crossAxisAlignment:&lt;/span&gt; &lt;span class="n"&gt;CrossAxisAlignment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;start&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;children:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Widget&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;[&lt;/span&gt;
              &lt;span class="n"&gt;EmailField&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;onDataChange:&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;setState&lt;/span&gt;&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
              &lt;span class="o"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;PasswordField&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;onDataChange:&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;setState&lt;/span&gt;&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
              &lt;span class="o"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;SubmitButton&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;onSubmit:&lt;/span&gt; &lt;span class="n"&gt;_onSubmit&lt;/span&gt;
              &lt;span class="o"&gt;),&lt;/span&gt;
            &lt;span class="o"&gt;],&lt;/span&gt;
          &lt;span class="o"&gt;),&lt;/span&gt;
        &lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="o"&gt;),&lt;/span&gt;
    &lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;_onSubmit&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_formKey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;currentState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;validate&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;_formKey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;currentState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;save&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

      &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_email&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
      &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_password&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Performance
&lt;/h3&gt;

&lt;p&gt;In terms of performance, we classify stateful widgets into two categories: cheap and expensive.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;cheap stateful widgets&lt;/em&gt; are those that allocate resources in the creation time and dispose of them when the widget is discarded.  They are computationally cheap because they consume little CPU and GPU time since they never are redrawn due to updates.  These widgets are commonly created as the root elements in the widget tree.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;expensive stateful widgets&lt;/em&gt; are those that allocate resources at creating time, but are subject to redrawing during its lifespan. They are the most common type of stateful widgets and will depend on &lt;code&gt;State.setState&lt;/code&gt; to trigger changes in response to events.&lt;/p&gt;

&lt;p&gt;To avoid performance issues regarding stateful widgets, the developer must take some simple measures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Try to place stateful widgets in the leaf nodes of the widget tree. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid the use of many transient widgets and complex layouts, especially for widgets that have a high update rate or a big widget subtree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Re-using a widget is a way more performant then rebuilding it. So, if the widget's subtree does not change, try to cache that. At first, extract the widget subtree to a stateless widget, then make it available as a child argument of the stateful widget. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;const&lt;/code&gt; widgets wherever possible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If in-depth changes are necessary for some reason, the subtrees must use a global key object, avoiding superfluous updates.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more information on stateful widgets, check &lt;a href="https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html"&gt;the documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, you can check this video:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/CXedqMlLo7M"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Widgets are a key role for a Flutter developer since each application is structured as a widget tree. As React, Flutter uses the concept of one-way data binding, meaning that data flows in a single direction, i.e., from a parent widget to its children. That creates a situation where there are widgets that holds data as an inner state, reacting to its changes, and others that do not. Those are stateful and stateless widgets, respectively.&lt;/p&gt;

&lt;p&gt;Due to state operations, stateful widgets consume more computational resources than the stateless ones. Therefore, developers might take some actions to prevent performance lags and deliver a smooth experience to the user. &lt;/p&gt;

&lt;p&gt;Finally, stateless widgets can decrease performance due to constant repaints, mainly because they cannot cache widgets when they have a complex widget subtree. To avoid those problems, developers must be aware of the performance tips from Google's documentation to build applications that render smoothly. &lt;/p&gt;

</description>
      <category>flutter</category>
      <category>android</category>
      <category>ios</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Thoughts about Clean Coding</title>
      <dc:creator>Francisco Souza</dc:creator>
      <pubDate>Mon, 16 Mar 2020 18:23:03 +0000</pubDate>
      <link>https://dev.to/francisceioseph/thoughts-about-clean-coding-184c</link>
      <guid>https://dev.to/francisceioseph/thoughts-about-clean-coding-184c</guid>
      <description>&lt;p&gt;The purpose of any software project is to provide a high-quality solution for a client meeting some timetable. But sometimes it is not possible to do so because of many factors like unforeseen requirements, lack of team members and an unrealistic delivery schedule. &lt;/p&gt;

&lt;p&gt;Another big problem that can decrease the developer's productivity is bad-written code. As a developer, I spend a lot of my working hours reading and trying to understand what other developers had done and how I can fix their mistakes. Unfortunately, it is usual for me to find pieces of code that are so cryptic that it would be better to rewrite it from scratch. &lt;/p&gt;

&lt;p&gt;That kind of situation is called Technical Debt. That is the amount of rework required to correct problems created during software development by poor implementation choices, like the use of limited solutions or the lack of expressiveness on code. This sort of situation increases the software entropy, also like any form of debt, it can accumulate over time, making the proper corrections harder to implement.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is clean coding?
&lt;/h2&gt;

&lt;p&gt;Clean coding is a development-driven philosophy that allows developers to use simple techniques to create and maintain code that is readable, effective, understandable and easily maintainable. The main focus is to decrease technical debt by creating a self-explanatory narrative that allows the introduction of changes and new features in a more natural way.&lt;/p&gt;

&lt;p&gt;Each programmer is responsible for using and applying the clean coding rules, but the best results show up when all team members can make use of those conventions. Therefore, the whole team must compromise itself to a culture change and to the implementation of mechanisms that enforces that new coding standard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clean coding techniques
&lt;/h2&gt;

&lt;p&gt;In his book Clean Code: A Handbook of Agile Software Craftsmanship, Robert Martin explains the clean-coding philosophy and methods. Those are generic enough to used by any software project, despite the chosen programming language or the framework adopted.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Focus on Simplicity
&lt;/h3&gt;

&lt;p&gt;Simplicity is the main point of all clean-coding philosophy. It means that the developers must avoid the use of complicated or obscure logic. Instead, they must use simple and straightforward logic. Finally, they must use well-known algorithms and coding conventions.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Significative Naming Convention
&lt;/h3&gt;

&lt;p&gt;Programmers are used to creating and naming a lot of entities when writing code. They must pay attention to each language, or framework, naming convention and follow it. Also, they must avoid the use of too short, or too long identifiers. Those must be concise and simple, allowing the reader to understand its purpose without much more information.&lt;/p&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Opens a certain file in reading mode&lt;/span&gt;

&lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="nf"&gt;openFileInReadingMode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// function body&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Saves a text file&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;saveTextFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// function body&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Write short functions
&lt;/h3&gt;

&lt;p&gt;A function is a piece of code that is responsible for executing one well-defined task. Therefore, a programmer must avoid writing big chunks of code that perform several operations at once, but break that in some small and self-contained procedures.&lt;/p&gt;

&lt;p&gt;Each development team is responsible for creating the naming conventions and assuring its use. But, there is some common sense that everybody can use to improve the source code readability.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Function names must be concise and accurate. They must describe what the function does and the possible side effects. And the users must be capable of understanding the function's purpose without knowing how it works.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;DBConnection&lt;/span&gt; &lt;span class="nf"&gt;connectToDevelopmentDB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// function body&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;calculateProductDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Product&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;promoCode&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// function body&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Functions must have fewer arguments as possible. However, if many arguments are required, the developer must provide a configuration object instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;
&lt;span class="c1"&gt;//bad example&lt;/span&gt;
&lt;span class="n"&gt;DBConnection&lt;/span&gt; &lt;span class="nf"&gt;connectToPostgres&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// function body&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//good example&lt;/span&gt;
&lt;span class="n"&gt;DBConnection&lt;/span&gt; &lt;span class="nf"&gt;connectToPostgres&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DBConnectionConfig&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;// function body&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The main goal of writing functions is to avoid duplications. So, the redundant code must be extracted to an independent function that will replace all duplicates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="nf"&gt;mapJsonToUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;userJson&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;dynamic&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;userMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;decode&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userJson&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromMap&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userMap&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;dynamic&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;async&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;await&lt;/span&gt; &lt;span class="n"&gt;MyHttpClient&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;post&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'/users'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;data:&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;mapJsonToUser&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="nf"&gt;updateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;dynamic&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;async&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;await&lt;/span&gt; &lt;span class="n"&gt;MyHttpClient&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;patch&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'/users'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;data:&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;mapJsonToUser&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Add Meaningful Comments
&lt;/h3&gt;

&lt;p&gt;"Source code must document itself" is a common motto among clean coding advocates. However, it is not always possible to provide meaning to the user using only well-written source code. Sometimes, it is necessary to give an additional explanation about obscure passages or specific logic.&lt;/p&gt;

&lt;p&gt;Comments must be written according to a previously agreed format, therefore the user can find the needed information fast. Also, comments must be short and condense as much information as possible, avoiding long and hard to read chunks of text.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Test the Code
&lt;/h3&gt;

&lt;p&gt;Testing is ordinarily used as a measure to ensure that some implementation is compliant with its requirements. It is also responsible for keeping the code clean, flexible and maintainable, therefore changes can be introduced without breaking anything. Finally testing provides important insights to the developer, therefore helping to create well-written code.&lt;/p&gt;

&lt;p&gt;It is important to choose a proper test suite that is recommended for the framework in use, following its philosophies and conventions. Also, tests must be readable, dense and assertive. Each test must deal with one feature at a time and run autonomously. Variables and memory allocated before each test need to be released after each one completes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Nowadays, the pace of technological change is growing faster. Each day, developers are fixing broken code and adding new features to their respective projects. But, to each new feature or fix, many other errors can be introduced and harm the software quality. To avoid this situation, improve the code quality and pay the existing technical debts are fundamental. To make this feasible, the use of clean coding techniques is fundamental.&lt;/p&gt;

&lt;p&gt;Clean coding procedures are concise, simple. They emphasize that the programmer truly owns the code he produces and that he is the main responsible for the quality of the final product. Therefore, for those measures to be effective, the development team has to be sure that everybody is aware of this commitment and enforce it.&lt;/p&gt;

&lt;p&gt;For more content related to clean coding, I recommend the book Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. &lt;/p&gt;

&lt;p&gt;If you already read the book but want just a summary to make a checklist, &lt;a href="https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29"&gt;this gist is for you&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cleancode</category>
      <category>productivity</category>
      <category>agile</category>
    </item>
    <item>
      <title>What about Flutter?</title>
      <dc:creator>Francisco Souza</dc:creator>
      <pubDate>Fri, 13 Mar 2020 18:51:14 +0000</pubDate>
      <link>https://dev.to/francisceioseph/what-about-flutter-27h2</link>
      <guid>https://dev.to/francisceioseph/what-about-flutter-27h2</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In mid-2007, Steve Jobs introduced to the world the most loved product Apple has ever crafted and the de facto first smartphone: the first-generation iPhone. His main goal was to radically change how we interacted in a connected world and to revolutionize the current &lt;em&gt;status quo&lt;/em&gt; of the mobile computing industry. Realizing the great opportunities offered by that new-borne market, Google launched its operating system for mobile devices in the following year, the Android OS.&lt;/p&gt;

&lt;p&gt;Evolving through many iterations and receiving a whole new lot of features, they are now the platforms that aim billions of people around the world to be part of an interconnected global economy. This new scenario is responsible for the current high demand for mobile apps which availability in Apple’s and Google’s ecosystems is practically mandatory for companies that intend to maximize their profits. Also this demand for apps created a budgetary problem because a company should keep two different sets of professionals to develop, maintain and distribute those apps for each platform using a native approach.&lt;/p&gt;

&lt;p&gt;Through time many solutions were proposed to solve those problems. The most famous frameworks use web technologies (like HTML5, CSS and Javascript) as Ionic and React Native does. The main goal is to use a single code base to create a product, compile it to the targeted OS and upload the generated binary file to the App Store or Google Play. This approach worked well for the last years, but nowadays the users have more expectations on the look and feel of the available mobile apps. They require them to have great design, smooth animations and optimal performance without compromising the inclusion of new features. And this is the main reason why Google decided to enter this game creating Flutter.&lt;/p&gt;

&lt;h2&gt;
  
  
  But, what is Flutter?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;

&lt;p&gt;Flutter is UI Toolkit created by Google in mid-2017 intended to help developers to create pixel-perfect apps that look and feel like native ones. Also it should enable a developer to make those apps available for mobile devices, the web and desktop without compromising performance and the user experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TLu_tvCf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4nc7nbwyijf24l8mgak2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TLu_tvCf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4nc7nbwyijf24l8mgak2.png" alt="Flutter Architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the image above, the Flutter framework can be sliced into three basic layers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;The Embedder&lt;/em&gt;: This is the native part of every flutter application and it is responsible to provide an interface to interact and access resources of the targeted OS. It also provides the most basic features that the Engine layer uses to control the app’s lifecycle and the widget painting process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;The Engine&lt;/em&gt;: This is the core of each Flutter App, and can be divided in basically three sub-modules: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Dart Virtual Machine&lt;/em&gt;: Responsible for interpreting and executing all Dart Code created by the layer above.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Rendering Engine&lt;/em&gt;: Its main responsibility is to paint efficiently the widgets created by the layer above and assure that animations will be played smoothly. It is written in C/C++ to boost performance and uses Skia Graphics Engine to efficiently paint each widget on the screen.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt; Skia is an open-source 2D graphics library that provides common APIs that work across a variety of hardware and software platforms. It serves as the graphics engine for Google Chrome and Chrome OS, Android, Mozilla Firefox and Firefox OS, and many other products. &lt;/blockquote&gt;

&lt;blockquote&gt; Skia is sponsored and managed by Google but is available for use by anyone under the BSD Free Software License. While engineering of the core components is done by the Skia development team, we consider contributions from any source.&lt;/blockquote&gt;

&lt;blockquote&gt; Source: [Skia WebSite](https://skia.org/)&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Services&lt;/em&gt;: Interfaces that allow the Framework layer to access the engine services, like the rendering engine, platform channels (access the system’s resources) and listen to system events.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;The Framework&lt;/em&gt;: this is the layer that the programmer will interact daily. It contains the foundational resources upon what all the Flutter’s widgets are built. This layer also offers the two main themes used to create Flutter apps: &lt;em&gt;material&lt;/em&gt; and &lt;em&gt;cupertino&lt;/em&gt;. The material theme is responsible for implementing widgets that are compliant with the second version of Google's Material design system. In the same way, the Cupertino theme implements the look and feel of the iOS native design system. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Characteristics
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;All flutter apps are compiled and optimized for ARM architecture in production mode and optimized for debugging in development mode. Also &lt;em&gt;hot reloading&lt;/em&gt; is available in development and it is simply awesome!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As shown in the architecture section, all Flutter widgets are build using &lt;a href="https://dart.dev/"&gt;Dart&lt;/a&gt;, a language created and maintained by Google itself. Dart is optimized to easily create user interfaces using code at the same time that offers a similar syntax to C#, JS, Swift and Kotlin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Due to performance improvements, Flutter renders its widgets that mimic the underlying OS components. So, a new embedder must provide a canvas upon what the Skia Engine will draw the user interface itself and services to access resources of the system. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extensibility is granted by the aggregation of third-part plugins that adds new components or allows the use of the OS resources that are not yet available in the built-in classes. All those libraries can be found in the &lt;a href="https://pub.dev/"&gt;official repository&lt;/a&gt; and added as dependencies in the apps &lt;em&gt;pubspec.yml&lt;/em&gt; file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Similarly to the React ecosystem, a flutter app can be described as a widget tree and the UI can be defined is the result of a function applied to the current app state. Therefore, as in React, data flows in a unidirectional way: from a parent widget to its children and each widget is repainted only if the application state changes and it affects the widget state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Platform custom code is super easy to write. The &lt;code&gt;Platform&lt;/code&gt; class has some static methods that help to identify the current OS and execute specific code. Also, some widgets like &lt;code&gt;Switch&lt;/code&gt; implements the &lt;code&gt;adaptative&lt;/code&gt; constructor that chooses the widget theme based on the current OS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It helps to efficiently create Minimal Viable Products and Proof of Concepts. Due to increased development speed, great UI flexibility and minimum setup time, Flutter helps to easily approach and validates business ideas. Also features as hot reloading helps to speed up the implementation of feedback from clients.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;p&gt;For a long time, many companies have struggled to deliver high-quality apps using a hybrid approach. Performance issues, slow development time, limited UI development and other downsides have made companies to move away from more traditional hybrid solutions and give Flutter a try. In the &lt;a href="https://flutter.dev/showcase"&gt;showcase&lt;/a&gt; page you can find a whole lot of companies that are developing apps using Flutter. In this list you can find some big players like Tencent, Alibaba, The New York Times and eBay.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Flutter is a new framework from Google that speeds up the app development cycle by focusing on key features like interface building, performance and extensibility. By rendering its widgets, the developer can easily and rapidly extend and implement new features without losing the look and feel of the operating system upon which the app will run. &lt;/p&gt;

&lt;p&gt;There are some critics because of Google's choice to use Dart instead of Javascript/Typescript. But after playing with Dart for some time and developing some simple apps, I realized that the language really resembles a lot the most popular C-like programming languages and it was not hard to learn.  &lt;/p&gt;

&lt;p&gt;Finally, I believe Flutter is a trend to 2020 mobile app development and it really worths a try. As time passes by and this technology solidifies, it is certain that more companies are going to adopt it as a first-class framework for cross-platform app development. &lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>android</category>
      <category>ios</category>
    </item>
  </channel>
</rss>
