<?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 Satyajit Malugu on Medium]]></title>
        <description><![CDATA[Stories by Satyajit Malugu on Medium]]></description>
        <link>https://medium.com/@satyajit?source=rss-71cf78439c4c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8UJoP0-CVvhCT_v3SFGEug.png</url>
            <title>Stories by Satyajit Malugu on Medium</title>
            <link>https://medium.com/@satyajit?source=rss-71cf78439c4c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:04:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@satyajit/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[To retry or not, is the question]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@satyajit/to-retry-or-not-is-the-question-66fb91507c3d?source=rss-71cf78439c4c------2"><img src="https://cdn-images-1.medium.com/max/720/1*5RW0eBywSJ8NTqC8lqhbaQ.png" width="720"></a></p><p class="medium-feed-snippet">Flaky tests are a big problem for an affective continuous integration setup. We want our CI to be running all tests and continuously&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@satyajit/to-retry-or-not-is-the-question-66fb91507c3d?source=rss-71cf78439c4c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@satyajit/to-retry-or-not-is-the-question-66fb91507c3d?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/66fb91507c3d</guid>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Sun, 22 Oct 2023 19:17:59 GMT</pubDate>
            <atom:updated>2023-10-22T19:17:59.281Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[When to combine your mobile repos to a monorepo]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@satyajit/when-to-combine-your-mobile-repos-to-a-monorepo-d73a6a66a030?source=rss-71cf78439c4c------2"><img src="https://cdn-images-1.medium.com/max/960/1*2UxgOpKggCVDlzpHIAcZSg.jpeg" width="960"></a></p><p class="medium-feed-snippet">A monorepo combines various technological stacks that produce different deployables into a single code repository. For a mobile repo, we&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@satyajit/when-to-combine-your-mobile-repos-to-a-monorepo-d73a6a66a030?source=rss-71cf78439c4c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@satyajit/when-to-combine-your-mobile-repos-to-a-monorepo-d73a6a66a030?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d73a6a66a030</guid>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Wed, 18 Oct 2023 01:47:55 GMT</pubDate>
            <atom:updated>2023-10-18T01:47:55.405Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to get feedback from designers while building flutter widgets]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Widgets are the central piece of flutter, outside of standard widgets provided by flutter framework, organizations would most likely&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@satyajit/how-to-get-feedback-from-designers-while-building-flutter-widgets-cc91d7b7097f?source=rss-71cf78439c4c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@satyajit/how-to-get-feedback-from-designers-while-building-flutter-widgets-cc91d7b7097f?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc91d7b7097f</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[widget]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Wed, 25 Jan 2023 20:04:54 GMT</pubDate>
            <atom:updated>2023-01-25T20:04:54.740Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Design system vs theme vs themeData]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Flutter, Android (or probably) every other UI system has these concepts that help designers and engineers create shareable UI systems.</p><p class="medium-feed-link"><a href="https://medium.com/@satyajit/design-system-vs-theme-vs-themedata-a9c668e2867d?source=rss-71cf78439c4c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@satyajit/design-system-vs-theme-vs-themedata-a9c668e2867d?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9c668e2867d</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[themes]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Wed, 23 Nov 2022 06:28:36 GMT</pubDate>
            <atom:updated>2022-11-23T06:28:36.604Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Comparing flutter and android code constructs]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@satyajit/comparing-flutter-and-android-code-constructs-18afcdbf45b1?source=rss-71cf78439c4c------2"><img src="https://cdn-images-1.medium.com/max/2266/1*jNJaPmLGYgBDcaBHEUdfyQ.png" width="2266"></a></p><p class="medium-feed-snippet">As you can see a lot of constructs are available at the framework level and for what&#x2019;s not there are community provided package options&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@satyajit/comparing-flutter-and-android-code-constructs-18afcdbf45b1?source=rss-71cf78439c4c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@satyajit/comparing-flutter-and-android-code-constructs-18afcdbf45b1?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/18afcdbf45b1</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Sun, 20 Nov 2022 18:50:45 GMT</pubDate>
            <atom:updated>2022-11-23T05:32:47.016Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What E2E Automation suites can learn from Production applications]]></title>
            <link>https://medium.com/@satyajit/what-e2e-automation-suites-can-learn-from-production-applications-a3f21fd2c8b9?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3f21fd2c8b9</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[e2e-testing]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Sun, 16 Oct 2022 03:12:57 GMT</pubDate>
            <atom:updated>2022-10-16T03:17:32.621Z</atom:updated>
            <content:encoded><![CDATA[<p>While at first glance it might appear they don’t have any commonalities, in this article I would like to share some insights I gained after working in a full stack team and a long career in test automation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*hOrXZxF0xdtEsRXgrXZwZg.png" /></figure><p><em>First some definitions</em></p><p>Production applications:</p><blockquote>A currently deployed, backend software application that is actively being used by users; typically served as an API. Examples like: email server, credit card processor, google docs</blockquote><p>E2E Automation:</p><blockquote>A black box End to End test automation suite that runs on an UI client that is being run in a regular cadence. Examples: Selenium UI test suite, XCUI iOS tests</blockquote><p><strong>Real world</strong></p><p>By definition both of them run in a real world, there is no control (no <a href="https://devopedia.org/mock-testing">mocking</a>). They have to deal with varying device sizes, network conditions, flakiness of other services, feature flags and 3rd party integrations.</p><p>So, when authoring test suites, don’t forget that your suite would be operating under much different circumstances than when you are developing.</p><p><strong>Observability</strong></p><p>Our production application has various kinds of logging, error tracing and tools to monitor both business and developmental metrics. We even buy tools like Splunk, Datadog to keep up with immense about of logs generated to gain insights into our application. Similarly, a test automation suite needs logs, screenshots, recordings, device logs, track record of previous success/failures, timestamps etc to know how automation suite is performing.</p><p><strong>External hardware providers</strong></p><p>Unless you have a strong reason no company is hosting their own servers, they run in AWS or Azure or GCloud. Similarly, your test suite should probably run on hosting providers like Firebase, Bitrise, Amazon farm, Saucelabs or similar.</p><p><strong>Maintenance</strong></p><p>No matter how much mature an application is, there are always changes like Java/node version, gradle version, dependencies versions, security patches, OS upgrades etc. One has to continuously keep up with them. That’s the cost of creating software. Similar concerns exist for a test suite as well.</p><p><strong>If something fails try again</strong></p><p>While software purists might scoff at this sentiment, a standard IT responses for computer trouble is</p><blockquote>have you tried to turn it off and on</blockquote><p>You simply cannot predict all the state space your software can exist in and you will eventually run into a case that hasn’t been thought of during development.</p><p>So, don’t be embarrassed if you have some retries in your tests.</p><p><strong>Error threshold</strong></p><p>Following up on the previous point, we cannot raise an alarm for every 500 or 400 we encounter in our app, an SLA has be created and only after errors cross that threshold we can react. Even a multi-billion dollar business like like AWS S3 has only <a href="https://aws.amazon.com/s3/sla/">99.9</a>% guarantee.</p><p>So, don’t place unrealistic expectations of 100% pass rate on your E2E test suite.</p><p><strong>Continual Ownership</strong></p><p>Most applications now have a developer on-call schedule, meaning that there is a DRI(Directly Responsible Individual) 24/7. We have monitors, alerting, escalation mechanisms in place.</p><p>One can argue that automation suites need that kind of rigor and attention if we expect tests to be running at any time and anywhere.</p><p>Now, as a software organization, are you paying the same level of attention to your E2E suite as a production service? While there are <em>certainly some differences</em> like scale, security, revenue generated, risk to business etc, we can certainly argue they have similar characteristics.</p><p>And for an E2E automation suite to be successful we would be wise to employ all facets of observability, maintainability, error thresholds, hardware providers, ownership.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3f21fd2c8b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[11 surprising things my ACL surgery & recovery taught me]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@satyajit/11-surprising-things-my-acl-surgery-recovery-taught-me-21a597482bcf?source=rss-71cf78439c4c------2"><img src="https://cdn-images-1.medium.com/max/856/1*58stLyQQGChuPQVXAQFQkQ.png" width="856"></a></p><p class="medium-feed-snippet">1. It happens in a few seconds but impacts for months</p><p class="medium-feed-link"><a href="https://medium.com/@satyajit/11-surprising-things-my-acl-surgery-recovery-taught-me-21a597482bcf?source=rss-71cf78439c4c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@satyajit/11-surprising-things-my-acl-surgery-recovery-taught-me-21a597482bcf?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/21a597482bcf</guid>
            <category><![CDATA[recovery]]></category>
            <category><![CDATA[acl]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Sun, 10 Jul 2022 18:37:28 GMT</pubDate>
            <atom:updated>2022-07-10T20:06:19.271Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Backup massive Google photos collection to computer, a practical guide]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@satyajit/backup-massive-google-photos-collection-to-computer-a-practical-guide-83ddab8db6e2?source=rss-71cf78439c4c------2"><img src="https://cdn-images-1.medium.com/max/600/1*mWP2L-m_qLMc9bBkqJjNKQ.png" width="600"></a></p><p class="medium-feed-snippet">Like many of you, I am long time user of Google photos. The free storage, exceptional app and AI driven automatic stories were very&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@satyajit/backup-massive-google-photos-collection-to-computer-a-practical-guide-83ddab8db6e2?source=rss-71cf78439c4c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@satyajit/backup-massive-google-photos-collection-to-computer-a-practical-guide-83ddab8db6e2?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/83ddab8db6e2</guid>
            <category><![CDATA[google-photos]]></category>
            <category><![CDATA[download]]></category>
            <category><![CDATA[backup]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Tue, 17 May 2022 04:48:41 GMT</pubDate>
            <atom:updated>2022-05-17T04:48:41.239Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Running integration tests as part of MRs for Add-to-App flutter apps]]></title>
            <link>https://medium.com/@satyajit/running-integration-tests-as-part-of-mrs-for-add-to-app-flutter-apps-75bdd0823a45?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/75bdd0823a45</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Thu, 21 Apr 2022 03:06:59 GMT</pubDate>
            <atom:updated>2022-04-21T15:40:36.352Z</atom:updated>
            <content:encoded><![CDATA[<p>Our flutter app is a hybrid <a href="https://docs.flutter.dev/development/add-to-app">add to app</a> meaning that we are not a pure Dart app but we are embedding flutter into our native iOS and Android apps. We also adopted a gitsubmodule strategy meaning that our package repo and library repo are different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*iz3fHR9RyDUhIRO-BRjWCA.png" /><figcaption>Dart repo structure</figcaption></figure><p>Obviously as a mature software organization, we want to have robust test automation coverage including unit, widget and integration tests. And we want them to be running in CI/CD pipelines just like the pure native apps.</p><p>While it’s pretty straight forward to run unit and widget tests, integration tests have proven to be problematic.</p><h3>Problem 1:</h3><blockquote>Integration tests can’t be part of a package repo</blockquote><p>They need the .iOS and .android folders and build setup to boot up devices and run integration tests.</p><p>Ok, we can create them on the stand alone flutter repo.</p><h3>Problem 2:</h3><blockquote>Nobody is running these tests on the CI</blockquote><p>Ok, let’s create a script on the stand alone repo to trigger these tests and run them on cloud mac machines. It would look something like this</p><pre>echo -e “Run integration tests on mac”<br>bash ./runIntegrationTests.sh</pre><p>Now, we can run them on a schedule or ad-hoc.</p><h3>Problem 3:</h3><blockquote>Integration tests are getting out of sync and failing with compile errors</blockquote><p>Lets trigger the above script from the package repo, it would have few more steps</p><p>The .gitlab job would look like this</p><pre>run-all-integration-tests:<br> stage: integration<br> script:<br> — .gitlab/run-integration-tests-on-parent.sh<br> rules:<br> — if: ‘$CI_PIPELINE_SOURCE == “merge_request_event”’</pre><p>and the script</p><pre>git clone &lt;host&gt;/<a href="https://gitlab.com/sofiinc/mobile/sofi-x.git">parent.git</a> --recursive package-$CI_COMMIT_SHA<br>cd parent/package<br><strong>git checkout $CI_COMMIT_SHA</strong><br>cd ..<br>bash ./runIntegrationTests.sh</pre><p>Note that parent has the package as .gitsubmodule and we need to ensure to run the correct commit hash on the parent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*69bJkAY4VxMhonLR" /></figure><h3>Problem 4:</h3><blockquote>These tests are expensive and we don’t want to run them all the time.</blockquote><p>We want to run them when there is a change only in specific parts of the code or on demand.</p><p>Ok, lets add a label and change the rules</p><pre>run-all-integration-tests:<br> stage: integration<br> script:<br> — .gitlab/run-integration-tests-on-parent.sh<br> rules:<br> — if: ‘$CI_PIPELINE_SOURCE == “merge_request_event”’<br>   changes:<br>        - lib/modules/code/**/*<br> - if: &quot;$CI_MERGE_REQUEST_LABELS =~ /IntegrationTests/&quot; </pre><p>Now tests will run when code is being changed or when we add the label ‘IntegrationTests’</p><h3>Problem 5:</h3><blockquote>Package might break tests in parent and it would be impossible to get MR to green</blockquote><p>In above diagram we see that as long as tests don’t impact existing integration tests, we are good. They are providing feedback. But when there is genuine requirements change and our integration tests also need updating, we are now in a fix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/0*0pHPObmwSKV3nyXA" /></figure><p>Now, even if we have a branch on the parent with the test fix, that won’t pass either. So, now we have to pass the correct parent hash to the script. Recently I discovered <a href="https://about.gitlab.com/blog/2021/05/20/dag-manual-fix/">manual</a> jobs on gitlab and curiously enough that has the ability to add in custom variables at runtime.</p><p>Ok, now we can concoct a weird solution with following gitlab job and a modification to the script</p><pre>run-all-integration-tests:<br> stage: integration<br> script:<br>  — .gitlab/run-integration-tests-on-parent.sh<br> variables:<br>    PARENT_BRANCH: &quot;master&quot;<br> rules:<br> - if: &quot;$CI_MERGE_REQUEST_LABELS =~ /CustomIntegrationTests/&quot;<br>     <strong>when: manual<br> </strong>- if: &quot;$CI_MERGE_REQUEST_LABELS =~ /IntegrationTests/&quot;<br> — if: ‘$CI_PIPELINE_SOURCE == “merge_request_event”’<br>   changes:<br>        - lib/modules/code/**/*</pre><p>Note the ordering of the ifs is also important</p><p>Now the script, lets check for the existence of this variable $PARENT_BRANCH and if it is present, then change to that branch on the parent.</p><pre>git clone &lt;host&gt;/<a href="https://gitlab.com/sofiinc/mobile/sofi-x.git">parent.git</a> --recursive package-$CI_COMMIT_SHA</pre><pre>if [[ $PARENT_BRANCH ]]; then<br>  cd package-$CI_COMMIT_SHA<br>  <strong>git checkout $PARENT_BRANCH</strong><br>  cd ..<br>fi<br>cd parent/package<br>git checkout $CI_COMMIT_SHA<br>cd ..<br>bash ./runIntegrationTests.sh</pre><p>In gitlab UI you have to git the correct parent branch and the above script will pick it up</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*RkkKPjhHlRowjr9Tbltv8A.png" /><figcaption>gitlab manual run UI</figcaption></figure><p>All in all following are the steps when we run into issue 5</p><ol><li>Make code changes that affect integration tests in package repo, say in a branch -&gt; package_fix</li><li>Make parent repo, check out package_fix, fix the tests and push up a branch -&gt; parent_fix</li><li>Trigger the pipeline with the tag CustomIntegrationTests</li><li>Click run in gitlab UI for integration tests and enter key value pairs, key -&gt; PARENT_BRANCH, value -&gt; parent_fix</li><li>Now tests will pass on the package pipeline</li><li>Merge package</li><li>Merge parent repo MR</li></ol><p><em>Note that if you are running integration tests on merge to main branch, you will have a pipeline failure after step 6.</em></p><p>Though I got a solution working, I feel like it can simplified. Curious to know if there are any thoughts or simplifications.</p><p><em>If you like this post, please clap, Also you may also be interested in my other article, flutter modularization: </em><a href="https://medium.com/@satyajit/how-to-modularize-an-internflutter-app-8b2b9167d466"><em>https://medium.com/@satyajit/how-to-modularize-an-internflutter-app-8b2b9167d466</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75bdd0823a45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to modularize an internflutter app]]></title>
            <link>https://medium.com/@satyajit/how-to-modularize-an-internflutter-app-8b2b9167d466?source=rss-71cf78439c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b2b9167d466</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[autonomy]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Satyajit Malugu]]></dc:creator>
            <pubDate>Fri, 01 Oct 2021 04:16:36 GMT</pubDate>
            <atom:updated>2021-10-01T04:30:37.651Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to modularize an internal flutter app</h3><p><strong>One app strategy </strong><br>Unless you work for behemoths like Apple, Google or Microsoft your company has only one app in the app stores. This means that even though you have multiple teams and organizations with varying backends, deployment styles and skills, they all are forced to have one common code base for their mobile applications.</p><blockquote>One app to rule them all</blockquote><h4>Autonomy</h4><p>One of the core tenets of modern software development practices in product based companies <strong>is autonomy: i.e ownership of code and process</strong>. Each team owns their code, how it is deployed/tested etc. Over the last few years backend teams have gone extreme lengths on this principle by having small microservices that can easily be versioned, deployed, tested and owned by small teams. It has become the norm for modern development practices across different stacks Java, Node but for mobile developers this isn’t hasn’t picked up.</p><blockquote>Modularization is an attempt to bridge these contrasting principles</blockquote><p><strong>Modularization</strong> of mobile apps is an attempt to bridge these two contrasting principles and give back the feature teams some ownership. Each feature or an organization has their own component/module/package and they can independently run in that package without impacting others.</p><p><em>Note: This doesn’t mean that modules can be deployed independently to app stores and there isn’t a need for a central team to work through common issues such as upgrades, app size, crashes etc . A central team is still essential but each feature team can play freely in their own sandbox.</em></p><p>In this article, focus is on modularizing a flutter app, the same for iOS and Android is covered <a href="https://medium.com/mobile-app-development-publication/modularize-ios-and-android-app-67678f2688dc">elsewhere</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kqpi1kox1B0nDqQfM0N1YQ.png" /></figure><h4>Dart library packages</h4><p>To share code independently dart recommends using packages: <a href="https://dart.dev/guides/libraries/create-library-packages">https://dart.dev/guides/libraries/create-library-packages</a>. Each package will have its own <em>package.yaml</em> and code in <em>lib</em> and <em>test</em> folders.</p><p>I also recommend having a sub build files such as <em>build-feature-module.yaml</em> which is referenced from the main <em>.gitlab-ci.yaml </em>file, so that you can independently determine what build steps are required for passing your coding standards.</p><h4>Monorepos</h4><p>One way to create these modules/packages is to have each hosted in their own git repo. Each module is then brought into the main app as either submodules or hosted in an internal pub hosting service. But this approach might be too heavy handed for smaller mobile apps and <em>hard to collaborate, re-use code and establish company wide UI theming</em>. To address these issues you can employ <a href="https://en.wikipedia.org/wiki/Monorepo">monorepos</a> i.e a huge repo which consists of all the sub-packages under one file structure. While monorepos seem like an anti-pattern, for smaller to medium sized file structures they can ease management of file structures and deployment scripts. Also, it is intuitive that a mobile app has one deliverable. Hence keeping all of these packages together makes sense.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCzq6pBclHawMWh0jjuY0Q.png" /><figcaption>Parent repo references the sub packages</figcaption></figure><h4>Melos</h4><p>But monorepos present a challenge for managing versions, creating build scripts and running tests across all the packages. Enter <a href="https://pub.dev/packages/melos">melos</a>, a dart package management syste, that is used by high profile projects like <a href="https://github.com/FirebaseExtended/flutterfire/blob/master/melos.yaml">flutterfire</a>, <a href="https://github.com/aws-amplify/amplify-flutter/blob/main/melos.yaml">amplify</a> to manage their publicly available packages. While it is geared towards public facing packages, it can be modified to be used for private packages as well. One great thing about this setup is that the root project itself can be a package while also being the parent composing all the packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWL7WQQ525RRSkkOs-9RRw.png" /><figcaption>All modules under /packages folder and melos tying them together</figcaption></figure><h4>Pre-requisite for successful modularization.</h4><p>Existing app should be in a state already composed of modules for core functions such as networking, storage, UITheming, routes etc. Otherwise we could run into circular dependencies from the parent to child and child to parent packages, which isn’t good for long term.</p><p>Usually this is a huge lift, so I would recommend you start on this path before the code base becomes bigger and deeply coupled.</p><p>You can seen all the code that is used to demonstrate this concept here: <a href="https://github.com/prolificcoder/modularized_flutter_app">https://github.com/prolificcoder/modularized_flutter_app</a></p><p><em>Let me know your thoughts on this approach and if there are other strategies you have followed.</em></p><p><em>Also, if you have a hybrid flutter app and include a flutter package into your existing Android and iOS apps, stay tuned for the next post.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b2b9167d466" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>