<?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>Forem: Temitope Omotunde</title>
    <description>The latest articles on Forem by Temitope Omotunde (@topeomot).</description>
    <link>https://forem.com/topeomot</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%2F109435%2F7aab78b5-0af9-45d2-a1a3-01bdf3a5337e.jpeg</url>
      <title>Forem: Temitope Omotunde</title>
      <link>https://forem.com/topeomot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/topeomot"/>
    <language>en</language>
    <item>
      <title>Environment Variables In Serverless Framework</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Tue, 24 Jan 2023 00:55:49 +0000</pubDate>
      <link>https://forem.com/topeomot/environment-variables-in-serverless-framework-4h94</link>
      <guid>https://forem.com/topeomot/environment-variables-in-serverless-framework-4h94</guid>
      <description>&lt;p&gt;*It is established standards not to put secrets in codebases because of security. Usually the secrets are introduced to&lt;br&gt;
during deployment or code execution.&lt;/p&gt;

&lt;p&gt;For Serverless Framework, it is no different. To introduce environment variable at deployment through the serverless.yml file,&lt;br&gt;
use the environment key under provider key. *&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;...&lt;/span&gt;

&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aws&lt;/span&gt;
  &lt;span class="na"&gt;runtime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nodejs14.x&lt;/span&gt;
  &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;PERSON&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tope&lt;/span&gt;
    &lt;span class="na"&gt;STORE_KEY_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;34444&lt;/span&gt;

&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In code, you should be able to get the PERSON and STORE_KEY_ID environment variable as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;PERSON&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;STORE_KEY_ID&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;But there is still a security issue here, the serverless.yml is stll in your repository and anyone can have access to the value&lt;br&gt;
 just by checking the serverless.yml file.&lt;/p&gt;

&lt;p&gt;I would like to look at 2 ways, this problem can be solved.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Introducing the environment variables into the environment where the deployment process for the serverless application happens
and letting the serverless.yml reference those values.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;...&lt;/span&gt;

&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aws&lt;/span&gt;
  &lt;span class="na"&gt;runtime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nodejs14.x&lt;/span&gt;
  &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;PERSON&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${env.PERSON}&lt;/span&gt;
    &lt;span class="na"&gt;STORE_KEY_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${env.STORE_KEY_ID}&lt;/span&gt;

&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The question of having the environment variables in the environment depends on the environment. Usually most CI platforms  like Github Actions&lt;br&gt;
have ways for you to sepcify the secrets you want interjected into your CI environment. For Github Actions, these are called Action Secrets and &lt;br&gt;
you can find more in the video link &lt;a href="https://www.youtube.com/watch?v=3bz0IR-GDIw" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=3bz0IR-GDIw&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;What i want to focus on now is how to introduce these variables into the environment locally. It turns out Serverless framework can read&lt;br&gt;
from a .env file without any 3rd party plugin. All you just need to do is&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a .env to you folder, same level as your serverless.yml file with content
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PERSON=tope
STORE_KEY_ID=1234
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Add key useDotenv to the your serverless.yml file. This causes serverless to load environmental variables automatically from .env.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;...&lt;/span&gt;

&lt;span class="na"&gt;useDotenv&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aws&lt;/span&gt;
  &lt;span class="na"&gt;runtime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nodejs14.x&lt;/span&gt;
  &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;PERSON&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${env.PERSON}&lt;/span&gt;
    &lt;span class="na"&gt;STORE_KEY_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${env.STORE_KEY_ID}&lt;/span&gt;

&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;NOTE: this not make it automatically appear in your code, you still need to pass each of the environment to one in the environment key under provider.&lt;br&gt;
Don't forget to add your .env to your .gitignore file to prevent the file from being pushed to your central  repository.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;By passing in variables as serverless parameters from the Serverless Dashboard. Serverless Dashboard helps you store secrets that can be used accross different
team members. Generally use the .env file for local development and testing and use the secrets in Serverless dashbord for deployment in your CI.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is not an arcticle on Serverless Dashboard but let me show you where it seats in the serverless deployment process. &lt;br&gt;
The first time I used serverless framework , it was basically like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[serverless framework on machine] ====== deploy ====&amp;gt;  [AWS]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All AWS secrets and other secrets are introduced during deployment from the machine. This machine genrally was your local device.&lt;/p&gt;

&lt;p&gt;Now it is like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[serverless framework on machine]  =====&amp;gt; [Serverless Cloud] ====== deploy ====&amp;gt;  [AWS]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All AWS secrets and other secrets are introduced during deployment from the Serverless Cloud. This adds security and removes the risk of&lt;br&gt;
anyone jsut being able to deploy since there are security access check between any machine and the Serverless Cloud.&lt;/p&gt;

&lt;p&gt;The Serverless Dashboard is the dashboard for the Serverless Cloud. One of the things is does is the ability to store secrets as parameters.&lt;br&gt;
To access to parameters in your serverless.yml is shown below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;...&lt;/span&gt;

&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aws&lt;/span&gt;
  &lt;span class="na"&gt;runtime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nodejs14.x&lt;/span&gt;
  &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;PERSON&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${param.PERSON}&lt;/span&gt;
    &lt;span class="na"&gt;STORE_KEY_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${param.STORE_KEY_ID}&lt;/span&gt;

&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So how do you write your serverless.yml so it can work with both .env locally and parameters when going through the Serverless Cloud?&lt;br&gt;
Serverless framework gives us an easy way to do that&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;...&lt;/span&gt;

&lt;span class="na"&gt;useDotenv&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aws&lt;/span&gt;
  &lt;span class="na"&gt;runtime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nodejs14.x&lt;/span&gt;
  &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;PERSON&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${param.PERSON, env.PERSON}&lt;/span&gt;
    &lt;span class="na"&gt;STORE_KEY_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${param.STORE_KEY_ID, env.STORE_KEY_ID}&lt;/span&gt;

&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It checks for param.PERSON and falls back to env.PERSON. This helps make our serverless.yml very flexible.&lt;br&gt;
For some properties, this can be extended&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;PERSON&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${param.ENV, env.ENV, 'dev'}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE, do not use this for sensitive information, check only the param and the .env file.&lt;/p&gt;

&lt;p&gt;Please reach out with any questions or clarifications you need.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>community</category>
      <category>career</category>
      <category>coding</category>
    </item>
    <item>
      <title>Simple Web Crawler Service</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Sat, 18 Sep 2021 18:39:33 +0000</pubDate>
      <link>https://forem.com/topeomot/simple-web-crawler-service-4anp</link>
      <guid>https://forem.com/topeomot/simple-web-crawler-service-4anp</guid>
      <description>&lt;p&gt;&lt;em&gt;This was built based on the Backend Project Idea 1 given in the article &lt;a href="https://hackernoon.com/15-project-ideas-for-front-end-back-end-and-full-stack-web-developers-j06k35pi"&gt;https://hackernoon.com/15-project-ideas-for-front-end-back-end-and-full-stack-web-developers-j06k35pi&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Find project repository at &lt;a href="https://github.com/topeomot2/simple-web-crawler-service"&gt;https://github.com/topeomot2/simple-web-crawler-service&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Simple web crawler service that takes a page URL and returns the HTML markup of that page.&lt;/li&gt;
&lt;li&gt;Only handles absolute urls.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /?url={page absolute url}
Host: localhost:3000

Response
status: 200 OK
content-type: json
body: {
    data: "html Content"
}


GET /?url={wrong string}
Host: localhost:3000

Response
status: 400
text: 'send absolute url with protocol included'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt;
    &lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Libraries used
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://expressjs.com/"&gt;Express&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Personally, my go to web framework for Node.js apis. &lt;/p&gt;

&lt;p&gt;Express actually lives up to the definition on its site. It is Fast, unopinionated, minimalist Framework for Node.js. The unopinionated and minimalist can be a blessing  or a curse, depending on what your preferences are.&lt;br&gt;
 It means you need to make decisions on what tools you want to use. Express makes no assumptions for you.&lt;br&gt;&lt;br&gt;
 But no worries, with the &lt;a href="https://expressjs.com/en/starter/generator.html"&gt;express-generator&lt;/a&gt;, spinning up a basic api is simple.&lt;/p&gt;

&lt;p&gt;The code below creates a project with express and some folder and setup opinions. The --no-view means we are  not using any view template engines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;npx&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;generator&lt;/span&gt;
    &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;no&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;view&lt;/span&gt; &lt;span class="nx"&gt;simple&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;web&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;crawler&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;service&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find out more at &lt;a href="https://expressjs.com/en/starter/generator.html"&gt;https://expressjs.com/en/starter/generator.html&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://www.npmjs.com/package/validator"&gt;Validator&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;A library of string validators and sanitizers. Chose this because of the simple isURL function it has which helps us check if the url query  parameter is an absolute url with the protocol set.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Never use external inputs to your api without validation and sanitization&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; 
        &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;validator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
            &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;require_host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;require_protocol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;send absolute url with protocol included&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;a href="https://axios-http.com/"&gt;Axios&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;A very simple promise based HTTP Client. If you know how to use Promises, using  Axios will be a breeze. This does all the work of retrieving  the content of a page by making a GET request to the url.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getContent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;


    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;a href="https://jestjs.io/"&gt;Jest&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Jest is a JavaScript Testing Framework. It works for any form of JavaScript code or anything that compiles to JavaScript i.e TypeScript. It is simple and I would recommend it anytime. It is the only testing framework I use in JavaScript.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install as a devDependency
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;jest&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;add the  following line in the scripts section of package.json.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;test&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;jest --coverage --watchAll&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;--coverage : you want jest to create a coverage report&lt;br&gt;
--watchAll means you want continuous checking of code change and rerunning  tests. (This is good for TDD, but can be removed if not desired)&lt;/p&gt;

&lt;p&gt;The test can be found in the tests/app.test.js file.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://www.npmjs.com/package/supertest"&gt;Supertest&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The most important tests you can write for apis (and software in general) are integration tests. For apis, "route tests" are the integration tests. Supertest&lt;/p&gt;

&lt;p&gt;Route tests are tests that actually call endpoints in the apis and tests for the happy path and sad paths. Supertest is the package for write route test. Supertest is built on &lt;a href="https://github.com/visionmedia/superagent"&gt;superagent&lt;/a&gt;, which is  an HTTP request library. So your Express app is actually called like if a user was making a request&lt;/p&gt;

&lt;p&gt;Happy path is when you call the api correctly with all the expected parameters, you should the correct  successful response. Below is a test that checks the response for the happy path. &lt;/p&gt;

&lt;p&gt;The sad path is when you call the api incorrectly and you expect api to respond with the agreed response. &lt;/p&gt;

&lt;p&gt;But something very important to note, calling apis this way means that all dependencies will be called. Dependencies include things like Databases, 3rd party apis etc. There are 2 ways practically to handle dependencies&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mocking: This is the process of substituting the response from 3rd dependencies so that they are not  actually  called during the test. This is the approach used here. Instead of using the crawler.js module to call the url, I used Jest to Mock the module and return a response. This makes the test faster and more predictable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containerization: this is good for database dependent apis, instead of mocking the database, you can just spin up a container for that database, seed it (fill it with test data) and then run your test against  it. This can also be used for other infrastructural dependencies that the pai depends on.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Note: You can also use Mocking for the situation described in the Containerization section. I would advise that database are encapsulated in a service/model and then you can then mock the service/model&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the first of many project ideas, I want to get done. Most of them will be picked from project ideas, I find online. Please reach out with any advice, improvements or corrections you feel that is needed.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>api</category>
      <category>testing</category>
    </item>
    <item>
      <title>Basic Concepts for Beginner Software Engineers -  How the Internet Works</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Mon, 17 May 2021 08:36:16 +0000</pubDate>
      <link>https://forem.com/topeomot/basic-concepts-for-beginner-software-engineers-the-internet-342h</link>
      <guid>https://forem.com/topeomot/basic-concepts-for-beginner-software-engineers-the-internet-342h</guid>
      <description>&lt;p&gt;This is a series of basic concepts Software Developers should know. After many years of working as a Software Engineer, I have found out that knowing  this concepts can clear up a lot of difficulty in understanding more advanced concepts in programming.&lt;/p&gt;

&lt;p&gt;My approach is to explain each concept in basic terms and with easily understood examples. This is mainly for individuals who are new to software engineering, hence the oversimplification of more advanced concepts, or anyone who wants to understand more about certain concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Internet
&lt;/h3&gt;

&lt;p&gt;Before we can understand what the internet is, let us look at this scenario.&lt;/p&gt;

&lt;p&gt;Imagine yourself on a desktop computer, you would be able to use the software on your computer to do things like create word documents. Some years ago before the internet, if you were creating the documents for yourself, then you had no issues but if it was for other individuals to view on their own computers, you had the following options to get it to them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Copy it on a storage device e.g Floppy Disk (just showing my age) or USB Flash Drive and give it to an individual to view on his/her computer. For multiple users, they would either have to take turns copying the document or they each get a storage device with the same document. This was true even if all the desktops were in the same room.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As time went along, computers in the same relative area could be connected together to form a &lt;strong&gt;network&lt;/strong&gt; using cables or a wireless router. Instead of copying the document to a storage device, there could be a shared folder, where you could drop the document and other computers on the network could pick it up. Wow what a vast improvement. But it only worked for computers within the network. This network were limited by distance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;The epitome of all network is the Internet. The internet is a GLOBAL NETWORK  that connects all other networks. It is made up of over a billion computers, cables, WiFi towers, satellite and other infrastructure.&lt;/em&gt;&lt;/strong&gt; Everything works together to take simple idea of a network and make it global. On the global network, different software have been created that solves our document sharing problem for us. We can email the documents to users. We could use a file sharing service like We Transfer. These solutions remove the limitation of geography.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The concept of the internet brings up different questions.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do all the machines on the internet work together?
&lt;/h3&gt;

&lt;p&gt;All the infrastructure and computers that make the internet work are made by different manufacturers. Windows Desktops alone are made by HP, Dell then routers by another set of makers. These are just part of the billion devices that work together to make the internet function. How did all this manufacturers make all their devices work together?&lt;/p&gt;

&lt;p&gt;This brings us to the concept of protocols.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Protocols are agreements made by a set of bodies (made up of  Individuals and Companies) around certain aspect of communication on the internet.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These bodies include the Internet Engineering Task Force and the World Wide Consortium (W3C).&lt;/p&gt;

&lt;p&gt;There are protocols controlling every aspect of the internet. They  allow the seamless communication across different devices (computers, mobile phones, cars,  ...) by  different makers (HP, Apple, Tesla, ...).&lt;/p&gt;

&lt;p&gt;When a Device Manufacturer wants to make a device to be used on the internet, the device must follow all the Protocols agreed upon. Usually the Device Manufacturers are part of the group that. come up with this agreements.&lt;/p&gt;

&lt;p&gt;Popular example of Protocols are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transmission Control Protocol (TCP)&lt;/li&gt;
&lt;li&gt;File Transfer Protocol (FTP)&lt;/li&gt;
&lt;li&gt;Internet Protocol (IP)&lt;/li&gt;
&lt;li&gt;Simple Mail Transfer Protocol (SMTP)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without Device Manufacturers sticking to the Protocols, there would be no internet today.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do devices know how to find each other?
&lt;/h3&gt;

&lt;p&gt;Devices on the internet are like post office mail boxes, each has an address. The protocol that controls the addresses of devices on the internet is the Internet Protocol (IP) and every device has an Internet Protocol (IP) addresses.&lt;/p&gt;

&lt;p&gt;The most widely used version of the Internet Protocol is the version 4 (IPv4). Each device connected to the internet, gets a unique, numerical address like 154.120.70.149 . &lt;/p&gt;

&lt;p&gt;Whenever you send from one device to another on the internet, the message is sent along until it gets to a device with the IP address. Everything  on the internet is at  a location usually a Server which has an IP address including  websites we go to.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are domain names?
&lt;/h3&gt;

&lt;p&gt;Domain names were introduced as easier to remember and use addresses for devices on the internet. Instead of 154.120.70.149, you use &lt;a href="https://example.com"&gt;https://example.com&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;How does the internet know the IP address to go to when you type in your domain name?&lt;/p&gt;

&lt;p&gt;This is where Domain Name Servers (DNS) come. They map domain names to IP address. A typical flow involves&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;enter &lt;a href="https://example.com"&gt;https://example.com&lt;/a&gt; in the browser address bar&lt;/li&gt;
&lt;li&gt;if your browser cache has no entry for the domain, it requests it from the Domain Name Server&lt;/li&gt;
&lt;li&gt;An IP address is returned to the browser for caching and the browser request is made.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This basic simplified view of the internet will give you a simple picture of how things work and is something I wish I had when I started my software development journey.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>internet</category>
      <category>programming</category>
      <category>protocols</category>
    </item>
    <item>
      <title>The Prototype Inheritance in JavaScript is not an Accident</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Thu, 06 May 2021 08:04:02 +0000</pubDate>
      <link>https://forem.com/topeomot/the-prototype-inheritance-in-javascript-is-not-an-accident-1559</link>
      <guid>https://forem.com/topeomot/the-prototype-inheritance-in-javascript-is-not-an-accident-1559</guid>
      <description>&lt;p&gt;&lt;em&gt;I wonder why i had this gut feeling when working with JavaScript that  the Prototype Inheritance was an accident. After thinking about it, I realize, it was because of the following reasons&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I had written other languages before coming to JavaScript and those languages were main Object Oriented Languages or Functional like PHP, C++,  Java etc&lt;/li&gt;
&lt;li&gt;Most of the materials  I read to learn JavaScript never got to Prototypes until the end and after classes, which ensured that I had written a little JavaScript the way I wrote in other languages before finding out it had its own inheritance mechanism&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the ECMAScript specification which JavaScript is based off, after  introducing  the primitive types, you are introduced immediately to Prototypes in the next section which talks about Objects. It was critical for the developers that came up with the ECMAScript specification.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Prototype
&lt;/h2&gt;

&lt;p&gt;To understand what a prototype is, we must know some basic things about JavaScript&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apart from the primitive types, almost everything is an Object. A function is simply a callable object. Even the primitive types have Object versions. The Number Object is the object version of the number primitive type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdz7dawbmwxo1w2cjvl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdz7dawbmwxo1w2cjvl0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The  second which is the more interesting one (in my opinion) is the use of constructors. (Please remove your OOP brains for now, this has nothing to do with class constructors). These constructors are functions which when called with the new keyword creates a new Object. The code inside the constructor is then executed to initialize some or all of the object properties by initializing them.&lt;/p&gt;

&lt;p&gt;Below is an example of a constructor. In JavaScript, there are a lot of inbuilt constructors that we use, a major example is the Date function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febe31vqu09yt08humlb7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febe31vqu09yt08humlb7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every constructor has a property called a &lt;strong&gt;prototype&lt;/strong&gt;. This prototype is an Object which means you can set properties on it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzne7mdj79zut5pz64mn6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzne7mdj79zut5pz64mn6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Objects created from the same constructor also have a property called "&lt;strong&gt;prototype&lt;/strong&gt;" which reference (simply point to) the prototype of the constructor. They all point to the same prototype meaning they all see and share the same &lt;strong&gt;constructor prototype&lt;/strong&gt;. 
Continuing from our example above, it means they should all see the same value for height since height is on the constructor prototype.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxly4ddk4t397sh2jkez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxly4ddk4t397sh2jkez.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see from the result above, object1 and object2 have different names but they have the same height.&lt;br&gt;
The question then becomes there is no height  in the constructor but on its prototype, how did the JavaScript engine get the height correct. This brings us to Prototype-based Inheritance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Prototype chain means when you call for a property in an Object, if the property is not in the Object itself, JavaScript will look at the prototype of the Object which in our example points to the constructor's prototype and since there is a property height, that is the value for height for the original Object. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Note that since the prototype of objects are Objects themself, there is nothing that stops you from pointing them to another object. Personally I believe in allowing  the JavaScript engine manage the prototype referencing because I believe it was not meant to be used that way. Take for example the image below&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3qixyj3m1055ywgz9im8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3qixyj3m1055ywgz9im8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Calling the prototype property on the object2 gives undefined not because it does not exist but you are not suppose to access it directly (my opinion). But note that calling prototype on the constructor gives the prototype Object. This is deliberate and not an accident. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Constructors are like the base for other Objects. Shared properties between Objects should be on the constructor prototype. The prototype of objects are internal mechanisms for inheritance in JavaScript and should avoid setting it directly.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For Object prototype, a special accessor property called &lt;strong&gt;&lt;strong&gt;proto&lt;/strong&gt;&lt;/strong&gt; was introduced by browsers but is not included in the ECMAScript language spec. So please avoid using it in your code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally if you follow the prototype chain down until you get to the constructor prototype, this usually ends in the built-in type Object. This is where all the Object functions we use are like hasOwnProperty, toString, valueOf.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5j7kyz3y8x6mndn0omb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5j7kyz3y8x6mndn0omb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As much as it seems odd, the prototype inheritance in JavaScript is not an accident. It is how it is built and understanding it will help you write better JavaScript code.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>object</category>
      <category>beginners</category>
      <category>prototype</category>
    </item>
    <item>
      <title>Flutter: Everything is a Widget Series -- Part 4: MaterialApp</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Mon, 23 Sep 2019 09:06:58 +0000</pubDate>
      <link>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-4-materialapp-15a3</link>
      <guid>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-4-materialapp-15a3</guid>
      <description>&lt;p&gt;&lt;em&gt;One of the main themes that quickly jump at you while using Flutter is that everything is a widget. This series aims to help beginners understand this simple yet powerful concept and introduce them to basic widgets in Flutter.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To help us in this journey, I built a Twitter Mobile Clone App using only the inbuilt widgets that come with Flutter. You can find the code at &lt;a href="https://github.com/topeomot2/twitter-ui-app"&gt;https://github.com/topeomot2/twitter-ui-app&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Every Flutter app starts from a call to main(), which calls the runApp command. The runApp commands simply set up the root widget of the Application. We simply feed the command with the root widget and we start building our widget tree from there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void main() =&amp;gt; runApp(MyApp());
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Twitter UI',
      theme: new ThemeData(
          primaryColor: DarkModeBg,
      ),
      home: TwitterHomePage(),
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  MaterialApp
&lt;/h3&gt;

&lt;p&gt;According to the Flutter SDK comments&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A MaterialApp is an application that uses material design.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Material Design is a design language that was introduced by Google in 2014. By design language, we mean guidelines that help to give a unique but consistent look and feel. So Material Design is one such design language that has become popular from Applications on Mobile and Web.&lt;/p&gt;

&lt;p&gt;Every major framework has a port of Material Design elements that are available for use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://material-ui.com/"&gt;Material-UI: A popular React UI framework&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://vuetifyjs.com/en/"&gt;Vue Material Design Component Framework - Vuetify.js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For Android Applications, Material Design has become the defacto standard and is encouraged by Google. There are sets of components (designed with the material design guidelines)that are expected in a material design application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.android.com/guide/topics/ui/look-and-feel"&gt;Material Design for Android | Android Developers&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Flutter and Material Design
&lt;/h3&gt;

&lt;p&gt;The Flutter team also wants these components available to developers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They came up with a convenience widget that wraps several widgets that are commonly required for material design applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This convenience widget is called MaterialApp. So if you want to build an application that uses the material design guidelines out of the box, you simply wrap your screens in a MateriaApp widget and you get some awesome prebuilt widget.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flutter.dev/docs/development/ui/widgets/material"&gt;Flutter Material Components widgets&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  CupertinoApp
&lt;/h3&gt;

&lt;p&gt;Material Design Language is not the only one supported in Flutter. Material Design Language is used a lot in Android Applications, for IOS applications, we have the Cupertino Design Language.&lt;/p&gt;

&lt;p&gt;And the convenience widget that makes this available in flutter is the CupertinoApp.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flutter.dev/docs/development/ui/widgets/cupertino"&gt;Flutter Cupertino (iOS-style) widgets&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I use one of these design languages to give my app a consistent look and feel so that they look like applications that were built with the native SDKs either in Android and IOS. They save a lot of time.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>android</category>
      <category>ios</category>
      <category>widget</category>
    </item>
    <item>
      <title>Merge-Descriptors Library | JavaScript Library Code Breakdown</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Mon, 02 Sep 2019 05:13:02 +0000</pubDate>
      <link>https://forem.com/topeomot/merge-descriptors-library-javascript-library-code-breakdown-54ma</link>
      <guid>https://forem.com/topeomot/merge-descriptors-library-javascript-library-code-breakdown-54ma</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/QepTcYpAKTo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The Merge-Descriptors library is a NodeJs package with more than 8.5million download/week and used by Express. &lt;/p&gt;

&lt;p&gt;In this video, you will learn&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What merge-descriptors are&lt;/li&gt;
&lt;li&gt;Merging JavaScript Objects&lt;/li&gt;
&lt;li&gt;How merge-descriptors package works&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/channel/UCG916fExDk8GotibsYmN3nw"&gt;ReadCode TV&lt;/a&gt; is a youtube channel where I go through the codes of libraries to see how they work and learn about different programming concepts and techniques and how they have been applied. The aim is to help us become better programmers. The libraries will come from different languages including JavaScript, Java, Kotlin, PHP, Dart and other languages that I work with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/channel/UCG916fExDk8GotibsYmN3nw"&gt;Click here&lt;/a&gt; to subscribe.&lt;br&gt;
Follow ReadCode TV on &lt;a href="https://twitter.com/ReadcodeTV"&gt;twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>code</category>
    </item>
    <item>
      <title>Flutter: Everything is a Widget Series -- Part 3: State in Widgets.</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Wed, 21 Aug 2019 21:37:06 +0000</pubDate>
      <link>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-3-state-in-widgets-lml</link>
      <guid>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-3-state-in-widgets-lml</guid>
      <description>&lt;p&gt;&lt;em&gt;One of the main themes that quickly jump at you while using Flutter is that everything is a widget. This series aims to help beginners understand this simple yet powerful concept and introduce them to basic widgets in Flutter.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To help us in this journey, I built a Twitter Mobile Clone App using only the inbuilt widgets that come with Flutter. You can find the code at &lt;a href="https://github.com/topeomot2/twitter-ui-app"&gt;https://github.com/topeomot2/twitter-ui-app&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Before going on to the different widgets we need to look at the concept of "State". This is not a term unique to Flutter but can also be found in other languages, the most well-known being React.&lt;/p&gt;

&lt;p&gt;State generally means a set of properties that determine what "situation/condition" the application is in. One of the best analogy I have seen is the comparison of temperature as a State property that determines the "condition" of water. Increase the temperature to 100⁰C and above, water becomes steam (gaseous state), below 0 ⁰C, water becomes ice (solid state).&lt;/p&gt;

&lt;p&gt;Generally, State exists at different levels of the application. State Management is a major topic and articles can be found online. This &lt;a href="https://app.egghead.io/articles/what-is-state-why-do-i-need-to-manage-it"&gt;link&lt;/a&gt; includes a more technical look into state.&lt;/p&gt;

&lt;p&gt;For State at the widget level, Flutter gives us a State Class. Below is from the comments in the Flutter source code for the class.&lt;/p&gt;

&lt;p&gt;"State is information that (1) can be read synchronously when the widget is built and (2) might change during the lifetime of the widget."&lt;/p&gt;

&lt;p&gt;Based on whether a widget has a State Class attached to it or not, there are 2 basic widget types in Flutter, the Stateless Widget and the Stateful Widget.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stateless Widget
&lt;/h3&gt;

&lt;p&gt;From the Flutter source code&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;StatelessWidgets class are for widgets that always build the same way given a particular configuration and ambient state.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Stateless Widgets do not have a State class attached to them. Whatever configuration was passed during the widget creation cannot be changed internally by the widget itself. Below is an example of a Stateless Widget.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class StatelessSample extends StatelessWidget {

  final int count;

  const StatelessSample({Key key, this.count}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Text(count.toString(),
        style: TextStyle(
          color: Colors.white
        ),
      ),
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Note, anything you want to come into the widget during creation must come in through the constructor and they must be declared final. Meaning if you pass in the same configuration, you will always get the same state in your widget.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The widget creates its own UI by returning a widget in its own build method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nothing in the widget can change the UIof the widget directly after it has been created. Only a total recreation by passing in another “count” externally can change the value of count being displayed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;For the reason above, Stateless Widget are ideal for sections of the User Interface used mainly for displaying information and obviously the information must be passed into the constructor.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Stateful Widget
&lt;/h3&gt;

&lt;p&gt;From the Flutter source code&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A StatefulWidget is a widget that has mutable state.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let us look at a simple example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class StatefulSample extends StatefulWidget {

  final int count;

  const StatefulSample({Key key, this.count}) : super(key: key);

  @override
  _StatefulSampleState createState() =&amp;gt; _StatefulSampleState();
}

class _StatefulSampleState extends State&amp;lt;StatefulSample&amp;gt; {

  int count;

  @override
  void initState() {
    super.initState();
    count = widget.count;
  }
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        children: &amp;lt;Widget&amp;gt;[
          Container(
            child: Text(count.toString(),
              style: TextStyle(
                  color: Colors.white
              ),
            ),
          ),
          RaisedButton(
            child: Text('Increase Count'),
            onPressed: (){
              setState(() {
                count += 1;
              });
            }
          )
        ],
      ),
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please note the following&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There are 2 classes when it comes to Stateful Widget, a class that extends the inbuilt Flutter StatefulWidget itself and another class that extends the inbuilt State class. Every StatefulWidget must have a State class attached to it through the createState method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The actual UI of the Stateful widget comes from the State object that is attached to it. You indicate the UI by returning a widget in the build function of the state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The State class has a setState method, which the Flutter source code says “Notify the framework that the internal state of this object has changed”. This function notifies the framework which reruns the build function again with the updated properties of the state. &lt;br&gt;
So even though the external “count” cannot be changed since it is final, we can update the UI because we are using an internal count variable of the State object and we are rebuilding the UI by calling setState();&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;iniState is a method that is called once during the initialisation of any State object. We set the initial value of our internal count variable from here.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The properties above make Stateful Widgets ideal for container widgets which control the display of other widgets.&lt;/strong&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;No matter which you use, the build method in a Stateless or Stateful Widget is where you will return what you want displayed. As we learnt in the last lesson this can be simple inbuilt widgets or complex compositions.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>flutter</category>
      <category>android</category>
      <category>ios</category>
      <category>widget</category>
    </item>
    <item>
      <title>Flutter: Everything is a Widget Series -- Part 2: Composition is Key.</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Sun, 11 Aug 2019 22:18:33 +0000</pubDate>
      <link>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-2-composition-is-key-3b6h</link>
      <guid>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-2-composition-is-key-3b6h</guid>
      <description>&lt;p&gt;&lt;em&gt;One of the main themes that quickly jump at you while using Flutter is that everything is a widget. This series aims to help beginners understand this simple yet powerful concept and introduce them to basic widgets in Flutter.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To help us in this journey, I built a Twitter Mobile Clone App using only the inbuilt widgets that come with Flutter. You can find the code at &lt;a href="https://github.com/topeomot2/twitter-ui-app" rel="noopener noreferrer"&gt;https://github.com/topeomot2/twitter-ui-app&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Every Flutter app starts from a call to main(), which calls the runApp command. The runApp commands simply set up the root widget of the Application. From here onwards we are building a tree of widgets with the root widget as the origin.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;In Flutter, Widgets are the building blocks for other Widgets and the UI.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The technique used for this is Composition. You use widgets to compose other widgets and your UI (which can be seen as one giant widget) is composed of widgets too. We will use 2 examples to illustrate this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Twitter Mobile Clone App Widget Tree
&lt;/h3&gt;

&lt;p&gt;To illustrate this, below is a section of the widget tree for the Twitter Mobile Clone App.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F1%2AQRC0NRVmMrDZxWORfEh8pw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F1%2AQRC0NRVmMrDZxWORfEh8pw.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note the following&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MyApp Widget is the root widget. This will be loaded by a call to the runApp() in the main function.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void main() =&amp;gt; runApp(MyApp());
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Twitter UI',
      theme: new ThemeData(
          primaryColor: DarkModeBg,
      ),
      home: TwitterHomePage(),
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Widgets are not only for content but they are also for structure. Examples of such widgets are Column, Row, Padding, SizedBox, etc. Everything in Flutter development is a widget, even if they do not contain any content like text, images, etc. Everything extends to things like color, alignment, etc&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Widgets of a particular type can be reused as many times as is required.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As I said, we will be going through all these widgets in this series.&lt;/p&gt;

&lt;h3&gt;
  
  
  RaisedButton Widget
&lt;/h3&gt;

&lt;p&gt;The RaisedButton is one of the Button widgets inbuilt that comes with Flutter in the MaterialApp library. Below is the constructor code for a RaisedButton.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const RaisedButton({
  Key key,
  @required VoidCallback onPressed,
  ValueChanged&amp;lt;bool&amp;gt; onHighlightChanged,
  ButtonTextTheme textTheme,
  Color textColor,
  Color disabledTextColor,
  Color color,
  Color disabledColor,
  Color highlightColor,
  Color splashColor,
  Brightness colorBrightness,
  double elevation,
  double highlightElevation,
  double disabledElevation,
  EdgeInsetsGeometry padding,
  ShapeBorder shape,
  Clip clipBehavior = Clip.none,
  MaterialTapTargetSize materialTapTargetSize,
  Duration animationDuration,
  Widget child,
}) : assert(elevation == null || elevation &amp;gt;= 0.0),
     assert(highlightElevation == null || highlightElevation &amp;gt;= 0.0),
     assert(disabledElevation == null || disabledElevation &amp;gt;= 0.0),
     super(
       key: key,
       onPressed: onPressed,
       onHighlightChanged: onHighlightChanged,
       textTheme: textTheme,
       textColor: textColor,
       disabledTextColor: disabledTextColor,
       color: color,
       disabledColor: disabledColor,
       highlightColor: highlightColor,
       splashColor: splashColor,
       colorBrightness: colorBrightness,
       elevation: elevation,
       highlightElevation: highlightElevation,
       disabledElevation: disabledElevation,
       padding: padding,
       shape: shape,
       clipBehavior: clipBehavior,
       materialTapTargetSize: materialTapTargetSize,
       animationDuration: animationDuration,
       child: child,
     );

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Note the method parameter, ButtonTextTheme. This expects a Widget which expects a ButtonTheme Widget which itself extends an inheritedWidget.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The child parameter is of type Widget. It means we can pass a widget to this widget. Usually, a widget has either a parameter called either "child" or "children" depending on the widget itself. Column and Row widgets have a "children" parameter while a container has a "child" widget.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This principle of properties of Widgets containing other Widget is used throughout Flutter.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  For Android Developers
&lt;/h3&gt;

&lt;p&gt;As an Android Developers who use Java or Kotlin, this composition method in Flutter which leads to a lot of layers in your UI hierarchy which is something that is frowned upon when developing in those languages. In developing with Java and Kotlin with the Android ADK we aim for shallow hierarchy because the greater the number of layers in your UI hierarchy the slower thee app becomes.&lt;br&gt;
Flutter does not suffer from this type of limitation. How does Flutter manage this?&lt;/p&gt;

&lt;p&gt;Flutter has a layout algorithm that builds the UI from the Widget Tree at sublinear performance. The worst-case scenario will be Linear O(N) during the initial layout and sublinear (&amp;lt; O(N)) for subsequent UI update where N is the number of widgets.&lt;/p&gt;

&lt;p&gt;The combination of the sublinear layout algorithm other factors means you should not be scared of composing widgets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Composition is Key
&lt;/h3&gt;

&lt;p&gt;As you aim to become a better Flutter developer, keep in mind, widgets are the building block, composition is the technique for creating a building from the blocks.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>android</category>
      <category>ios</category>
      <category>widget</category>
    </item>
    <item>
      <title>Flutter: Everything is a Widget Series -- Part 1: Where Flutter fits in.</title>
      <dc:creator>Temitope Omotunde</dc:creator>
      <pubDate>Wed, 07 Aug 2019 22:41:12 +0000</pubDate>
      <link>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-1-where-flutter-fits-in-940</link>
      <guid>https://forem.com/topeomot/flutter-everything-is-a-widget-series-part-1-where-flutter-fits-in-940</guid>
      <description>&lt;p&gt;One of the main themes that quickly jump at you while using Flutter is that everything is a widget. The aim of this series is to help beginners understand this simple yet powerful concept and introduce them to basic widgets in Flutter.&lt;/p&gt;

&lt;p&gt;To help us get more insight into Flutter, I decided to build a Twitter Mobile App UI but with the following constraint.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use only widgets that come out of the box in Flutter.&lt;/li&gt;
&lt;li&gt;Do not use external libraries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For any point at which I deviate, you will be notified and given a reason. Below is the result and you can find the project at &lt;a href="https://github.com/topeomot2/twitter-ui-app" rel="noopener noreferrer"&gt;https://github.com/topeomot2/twitter-ui-app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fh87wtelb1tnj1sgzs2ct.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fh87wtelb1tnj1sgzs2ct.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a compiled list of the widgets used. We shall look at some basic concepts and look at each of the widgets used in this series.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Container&lt;/li&gt;
&lt;li&gt;Column&lt;/li&gt;
&lt;li&gt;Row&lt;/li&gt;
&lt;li&gt;Text&lt;/li&gt;
&lt;li&gt;SizedBox&lt;/li&gt;
&lt;li&gt;Expanded&lt;/li&gt;
&lt;li&gt;Icon&lt;/li&gt;
&lt;li&gt;Divider&lt;/li&gt;
&lt;li&gt;Padding&lt;/li&gt;
&lt;li&gt;TextStyle&lt;/li&gt;
&lt;li&gt;Card&lt;/li&gt;
&lt;li&gt;Scaffold&lt;/li&gt;
&lt;li&gt;AppBar&lt;/li&gt;
&lt;li&gt;ListView&lt;/li&gt;
&lt;li&gt;ListTile&lt;/li&gt;
&lt;li&gt;CircleAvatar&lt;/li&gt;
&lt;li&gt;Drawer&lt;/li&gt;
&lt;li&gt;MaterialApp&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An important feature of Flutter is its simplicity. Flutter is very simple, but also very powerful. And my aim in this series is to follow that same pattern and show its variety of use cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where do Widgets come in?
&lt;/h3&gt;

&lt;p&gt;To understand where widgets come in, we need to understand how development in Flutter works. To help, we’re going to look at the 2 major ways that applications have been developed for mobile platforms.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Native Development&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Native development, you write code which automatically makes use of the device OEM widgets for display and talks directly to the device services for capabilities like Bluetooth, camera, etc.&lt;br&gt;
Did you notice? I said OEM widgets. Meaning you will have to develop for each platform separately. They are done in languages that are chosen by the OEMs. For Android, that is primarily Java and Kotlin, Objective C and Swift for IOS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;: There is more access to device capabilities.&lt;br&gt;
&lt;strong&gt;Cons&lt;/strong&gt;: You have to develop separately for different platforms.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cross Platform Development&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Cross Platform development, these are majorly HTML, JavaScript, and CSS in WebView. These WebViews cannot talk to the OEM widgets for UI and definitely not the device services.&lt;br&gt;
The above translates to the use of a JavaScript Bridge, which acts as a layer between user code and the device capabilities. Because they talk through a bridge, you can write once and let the JavaScript Bridge do the work of talking to the native layer of whatever platform is there. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;: You get faster development since you only need to build once and it works on both Android and IOS.&lt;br&gt;
&lt;strong&gt;Cons&lt;/strong&gt;: This cannot utilize native device capabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  But what does Flutter do?
&lt;/h3&gt;

&lt;p&gt;It introduces another paradigm by taking the best of both worlds.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Flutter uses the Dart programming language which is then compiled into native ARM Code, which means your apps built with Flutter have full access to device services and capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To deal with the different OEM widgets, Flutter totally avoids OEM widgets and builds its own widgets using its own renderer. This means widgets that look and feel like the native OEM widgets and adapts to their respective platform.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But these widgets are so customizable that you can build a totally different experience from what the OEM normal look and feel like. It is all up to you.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So Flutter gives you Native Capabilities while doing Cross Platform Development. The main backbone of building Flutter apps is the Widget and we shall be looking at them in greater detail in the coming articles in this series.&lt;/p&gt;

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