<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by R Rifa Fauzi Komara on Medium]]></title>
        <description><![CDATA[Stories by R Rifa Fauzi Komara on Medium]]></description>
        <link>https://medium.com/@rifafauzi6?source=rss-ae92d7a4b191------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*26Q5MKz3ZZs-jJySF5stXA.jpeg</url>
            <title>Stories by R Rifa Fauzi Komara on Medium</title>
            <link>https://medium.com/@rifafauzi6?source=rss-ae92d7a4b191------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:08:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rifafauzi6/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mastering Flutter Modularization — In Several Ways]]></title>
            <link>https://medium.com/flutter-community/mastering-flutter-modularization-in-several-ways-f5bced19101a?source=rss-ae92d7a4b191------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5bced19101a</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[modularization]]></category>
            <dc:creator><![CDATA[R Rifa Fauzi Komara]]></dc:creator>
            <pubDate>Mon, 25 May 2020 10:01:01 GMT</pubDate>
            <atom:updated>2022-09-20T16:11:27.073Z</atom:updated>
            <content:encoded><![CDATA[<h3>Flutter: Mastering Modularization — In Several Ways</h3><p>Hello everyone, this is my first article on Medium. My name is Rifa, currently working as Software Engineer, Mobile (Flutter). In this article, I will share about how to <em>manage</em> the Flutter project to make it <em>scalable</em> with a <strong>modularization</strong> <em>approach</em>.</p><p>Before I explain further, here is the outline.</p><ul><li>What is Modularization</li><li>Why we should care about Modular approach?</li><li>Modularization in Several Ways</li><li>What Modularize can we use?</li><li>Conclusion</li></ul><h3><strong>What is Modularization</strong></h3><blockquote><strong><em>Modular programming</em></strong> is a software design technique to separate functionality into independent, interchangeable module, so that each contains everything necessary to execute a specific functionality.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHfu-pOlFzTnvGAj8a-VZQ.png" /><figcaption>Illustration to understand the modular approach</figcaption></figure><p>Before I explain the <strong>modular</strong> concept more <em>deeply</em>, does anyone understand the meaning of the picture above? If <strong>yes</strong>, you can compare your understanding of what I will write. If <strong>no</strong>, you can read <em>carefully</em> this article and make sure you are in <strong>focus</strong> condition!.</p><p>So, the meaning of the picture above is I am a student majoring in informatics on campus, then I go to the <em>library</em> to reading some <em>books</em>, after arriving there, of course, I will find the book that I need right? Usually, books in the library will be <strong>separated</strong> based on the department or course (if the campus library) in each bookcase and certainly <strong>neatly</strong>. Because the book is <strong>separated</strong>, it will make it <em>easy</em> for me to find the book I need. But what if it’s not separated? You can imagine all kinds of books from all majors, courses combined in the same cabinet and <strong>randomly</strong>. How do you feel about that? Surely it will be <strong>difficult</strong> to <em>find</em> <em>the book you want right? Maybe</em> you can <em>find</em> the book you want, but it will definitely take a very long time.</p><p>Let’s assume that the <strong>book</strong> we are discussing is the <strong>code</strong> we are going to write, then we assume the <strong>bookcase</strong> is the <em>Flutter project</em>. Surely, it will make it <em>difficult</em> for you to <strong>manage</strong> your Flutter project in the <strong>future</strong> because all the code is not <strong>separated</strong>. Why is that? You can see one of the examples below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ZTSuMEpyd0tjpaNVgspigA.gif" /><figcaption>sample bad structure project</figcaption></figure><p>As you can see above, the project combines <em>classes</em> that contain <strong><em>UI</em></strong>, <strong><em>widgets</em></strong>, <strong><em>logic</em></strong> and even <strong><em>data</em></strong> in the same file. And of course, <em>that makes too many lines of code, even though the project only shows one screen. </em>Can you imagine what if you make a very <strong><em>complex application</em></strong> but <em>follow</em> the <em>standards</em> like the picture above? <strong><em>Therefore you need to implement modularization!.</em></strong></p><h3>Why we should care about Modular approach?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1BsAGlOYB2lnOk-fguyrTw.png" /><figcaption>common project VS multiple modules</figcaption></figure><p>For example, on the left, we can only split the work for two developers or more. But on the right side, we can split the work for five developers or more, and also this is very suitable for a large team because we split the project as a module. So the developer can focus on their module.</p><h3>Modularization in Several Ways</h3><p>In this article, I will explain the concept of <strong>modularization</strong> in <em>several ways</em>.</p><blockquote>1. Basic<br>2. Unpublish (Local / Internet)<br>3. Publish</blockquote><h4>Basic</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n8YEEu6Jl6uTpHS28R6OjQ.png" /><figcaption>modularization using a basic style</figcaption></figure><p>To make your project implement <strong>modularization</strong> very <strong>easy</strong> and <strong>simple</strong>, you can follow an <strong>approach</strong> like the picture above. And the image below is an example of the structure of the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*fULN9SmWYoxxlM1MN6IRrw.png" /><figcaption>example structure project</figcaption></figure><p>And also, you can check this example of this project who implements <em>modularization</em> using a <strong>Basic</strong> style <a href="https://github.com/rrifafauzikomara/flutter_modularization/tree/master">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*AYjGMgms7VnxWD4cqU5Qng.gif" /></figure><blockquote>How is this? Very simple isn’t it? Let’s move on to the next stage.</blockquote><h4>Unpublish</h4><p>In this way, I will divide it into two parts, <strong>Locally</strong> and on the <strong>Internet</strong>.</p><p><strong>Locally</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2ifyXIe4Je-UMgo_rjXXw.png" /><figcaption>modularization using locally</figcaption></figure><p>In this step, we create <strong>3 modules</strong> (<em>BLoC, Network, </em>and<em> Repository</em>) inside the project. And this is below is an example structure project looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*JqEQfmw1Jje5QOtC4CcMQg.png" /><figcaption>example structure project of local modularization</figcaption></figure><p>As you can see, the <strong>flutter_modularization</strong> project has more than one module. Thus, we can separate several components into <em>separate functionality as an independent, interchangeable module, so that each contains everything necessary to execute a specific functionality.</em></p><blockquote>The question is, How to create a module?</blockquote><p>Okay, to create a module there are <em>several ways</em>, from <strong>Android Studio</strong> or <strong>Terminal</strong>.</p><p>From <strong>Android Studio</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNaCOzKZMEA-Ycq2QMFjSQ.png" /><figcaption>From Android Studio</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IGxS2DSlcO7s3Om8njL2TQ.png" /><figcaption>From Android Studio</figcaption></figure><p>From <strong>Terminal</strong>.</p><pre>flutter create --template=package name_of_module</pre><p>And, after you create some <strong>modules</strong>. Then, <em>you want to connect them to your root project</em>. You just add it to pubspec.yaml in the root of your project using path. It looks like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BcnTEEgWUzEwS4FSI9JL4Q.png" /></figure><blockquote><strong><em>How if our module is outside the project?</em></strong></blockquote><p>The answer is: You can use the path property and <strong>call</strong> <strong>.. </strong>first<strong> </strong>like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V8mcAulPKTktjVFWxK3Jvw.png" /></figure><p>And also, you can check this example of this project who implements <em>modularization</em> using <strong>Unpublish (Locally) </strong>style <a href="https://github.com/rrifafauzikomara/flutter_modularization/tree/local">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*1yYzQI2L7cIuizL3KkyE5A.gif" /></figure><blockquote>What do you think? It’s very Amazing, right?</blockquote><p><strong>Internet</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXp18vc1-rqojbyGgT8FEA.png" /><figcaption>modularization using internet</figcaption></figure><p>In this step, our<strong> modules</strong> (<em>BLoC, Repository, </em>and<em> Network</em>) that already created previously in the project, we save it to <strong>Github</strong>. And this is below is an example structure project looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t3Jz52PZAXV2uiSWiv_r1A.png" /><figcaption>sample</figcaption></figure><blockquote><strong>And how to add those modules to our project?</strong></blockquote><p>The answer is: You can just use the git and url property <strong>module </strong>like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMlMPnksVYgehbjctGb4Tw.png" /></figure><blockquote><strong>And how if the Github have many branches and want to use modules on specific branches?</strong></blockquote><p>The answer is: You can just use the git, urland refproperty <strong>module </strong>like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KG4O8Y-MC7IaI8TSya7Y3g.png" /></figure><p>But if we use this <em>approach</em>, we will get the <em>problem</em> to <em>update</em> and <em>reuse</em> our <em>module</em>. What it’s?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6HxynoS3L64ZO280a8JUA.png" /><figcaption>the problem when implementation of internet style</figcaption></figure><blockquote><em>If we </em>added<em>, </em>deleted<em>, or </em>changed<em> the </em><strong><em>function</em></strong><em> from </em><strong><em>module</em></strong><em> in the </em><strong><em>Git</em></strong><em> / </em><strong><em>Internet</em></strong><em>. The UI </em><strong><em>can’t</em></strong><em> take the </em><strong><em>update</em></strong><em> </em><strong><em>function</em></strong><em> from the </em><strong><em>module</em></strong><em> because you must </em><strong><em>publish</em></strong><em> the </em><strong><em>module</em></strong><em> </em><strong><em>update</em></strong><em> to </em><strong><em>git</em></strong><em> first (</em>git push<em>) and in the your </em><strong><em>project</em></strong><em>, must first take </em><strong><em>these</em></strong><em> </em><strong><em>updates</em></strong><em> from </em><strong><em>git </em></strong><em>(</em>git pull<em>),</em><strong><em> </em></strong><em>so you can take the </em><strong><em>updated</em></strong><em> </em><strong><em>function</em></strong><em> from your </em><strong><em>module/project</em></strong><em>.</em></blockquote><p>And the last way to implement <em>modularization</em> it’s <strong>Publish</strong> way. <em>But in this way, I can’t write it in this article and will share it in another article</em>. But take it easy, I will explain a little about this.</p><blockquote><em>For </em><strong><em>(Publish)</em></strong><em> it’s like</em> library <em>who add in the </em><strong><em>dependencies</em></strong><em> (Android Native) and </em><strong><em>host</em></strong><em> it into </em>maven<em> / etc and </em><strong><em>Plugin</em></strong><em> or </em><strong><em>Package</em></strong><em> who add in the </em><strong><em>pubspec.yaml</em></strong><em> (Flutter) and </em><strong><em>host</em></strong><em> it into </em><a href="https://pub.dev/"><em>pub.dev</em></a><em>.</em></blockquote><h3>What Modularize can we use?</h3><blockquote>1. Layer<br>2. Feature<br>3. Combine</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJrwv6XUS84x2tBx470NHQ.png" /><figcaption>separate the module by layer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MKLZyxu9Yj9m-Ck0HnMWw.png" /><figcaption>separate the module by feature</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUK7G2P52S3zlfcnP2k9lA.png" /><figcaption>separate the module by layer and feature</figcaption></figure><h3>Conclusion 💙</h3><p>👏Congrats!! Now you have learned about <strong>modularization</strong> and implemented it in the Flutter project. And because we use this <em>approach</em>, this is what we will get.</p><h4><strong>Without Implementation Modular</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6NsuCyLeelTCp0o5GwFvA.png" /><figcaption>without implementation modular</figcaption></figure><h4>With Implementation Modular</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLl-ouLAgmmEolUaDrKYgQ.png" /><figcaption>with implementation modular</figcaption></figure><p>So, if you need a full source code on this article about <strong>modularization</strong> (<em>Basic, BLoC, Local, </em>and<em> Network</em>). You can check this Github and make sure to read the <strong>README</strong> file first!.</p><p><a href="https://github.com/rrifafauzikomara/flutter_modularization">rrifafauzikomara/flutter_modularization</a></p><blockquote>And if you need more complex resources in implementing <strong>modularization</strong>, you can check this Github.</blockquote><p><a href="https://github.com/rrifafauzikomara/MovieCatalogue">rrifafauzikomara/MovieCatalogue</a></p><p>If you have any questions, feels free to contact me via direct message on any social media or my <a href="https://www.linkedin.com/in/rrifafauzikomara/">LinkedIn</a>. Thank you! 👋 and don’t forget to clap 👏 more on this post.</p><p><a href="https://www.twitter.com/FlutterComm">JavaScript is not available.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5bced19101a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/mastering-flutter-modularization-in-several-ways-f5bced19101a">Mastering Flutter Modularization — In Several Ways</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>