<?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 Marco Barragan on Medium]]></title>
        <description><![CDATA[Stories by Marco Barragan on Medium]]></description>
        <link>https://medium.com/@marco17851?source=rss-b004e5aafabd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Marco Barragan on Medium</title>
            <link>https://medium.com/@marco17851?source=rss-b004e5aafabd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 05:35:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marco17851/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[Flavorful Flutter]]></title>
            <link>https://medium.com/swlh/flavorful-flutter-be8de08ce331?source=rss-b004e5aafabd------2</link>
            <guid isPermaLink="false">https://medium.com/p/be8de08ce331</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[cross-platform]]></category>
            <dc:creator><![CDATA[Marco Barragan]]></dc:creator>
            <pubDate>Sat, 27 Jun 2020 00:50:26 GMT</pubDate>
            <atom:updated>2020-06-27T20:52:38.657Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-t9nBE3Ukj63sioC" /><figcaption>Photo by <a href="https://unsplash.com/@josenothose?utm_source=medium&amp;utm_medium=referral">Jose Fontano</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Flavorful Flutter (Part 1/2)</h3><h3>Spicing Up Your Flutter Applications Using Entrypoints</h3><p>Hey y’all. For the past couple of months, I’ve been working on a mobile application for a client in the airline industry. After deliberating with the client between native and cross-platform frameworks, we chose to proceed with Flutter for this project.</p><p>Given that Flutter it still quite new to the market compared to other frameworks, the architectural patterns and ways of working with Flutter are not nearly as defined. As a result, we have had more autonomy in deciding how to evolve our codebase given previous experience with other frameworks.</p><p>Because we are working on a mobile application in a professional setting, building and deploying an application becomes more complex than working on one as a hobby. When you are the only one working on a project, you can write and test your code locally to make sure that everything works well. Once you have the next available release build, you grab the bundle and upload it to the app store. In a professional setting, you have different stakeholders throughout the lifecycle of the application — from QAs to internal testers to production users.</p><p>Working with different stakeholders means that we need to create a version of the app that works in multiple environments. These environments usually, but not always, correlate with who is testing the application in that environment. For example, our QAs would need a version of the app that included not-yet-ready features that needed to be tested while our UAT internal testers needed to have an app that only included the features that had been tested already.</p><blockquote>One of the initial hurdles we faced when working on the mobile application for the client was creating a different version of the app for each environment we were working with.</blockquote><p>For our project, we had to make sure that our local application pointed to a local instance of our BFF (Backend For Frontend), the DEV version of the application to our DEV dependencies, the QAT version of the application to our QAT dependencies, etc. When the application and its functionality is approved by the users in one environment, it gets deployed to the next environment for another round of testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qHfEYPCbkOU_veSF" /><figcaption>Photo by <a href="https://unsplash.com/@tiard?utm_source=medium&amp;utm_medium=referral">Tiard Schulz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There are a couple of ways your Flutter application can work in multiple environments.</p><ol><li>Flutter Entrypoints</li><li>Flutter Flavors</li></ol><p>Both of these approaches have their pros and cons.</p><p>In Part 1, we will cover how to use Flutter Entrypoints, when it is appropriate to use them, and when you should avoid using them.</p><h3>Environment Structure</h3><p>Before we dive into entrypoints, let’s go over what these environments are and why they are necessary.</p><p>Let’s say you have the following environments: DEV, QAT, UAT, and PROD.</p><ul><li>DEV is used for local development. You can make changes locally without impacting testers or real customers</li><li>QAT is used to test the application by the team’s QAs to prevent bugs from going live.</li><li>UAT is used for closed beta testing by actual clients to get their feedback before releasing the application or any of the new features to the general public.</li><li>PROD is, well, openly available to the outside world via the app stores</li></ul><p>As we progress from one environment to another, we should expect higher quality in our test data and more stability from our dependencies.</p><blockquote>Not every team will use all of these environments and the naming convention might not even be the same. Regardless of the convention that you use, you will still need a version of the app that can be used in a specific environment.</blockquote><h3>Flutter Entrypoints</h3><p>In our team, we initially chose Flutter entrypoints to help us configure our application. It was, at the time, the simplest and easiest way of getting a flutter app to work in multiple environments.</p><p>We wanted to configure each environment with the necessary API endpoints so when you build the mobile application in PROD, for example, the application consumes the backend services that belong to the PROD environment.</p><blockquote>One fairly common thing in enterprise apps is that different environments have different API endpoints for their dependencies — hence the need for a way to configure mobile applications with the correct data.</blockquote><p>Flutter provides the ability to specify the entrypoint of an application when building or running an application.</p><blockquote>The default entrypoint is `lib/main.dart` so you don’t have to specify it when building or running the app.</blockquote><p>However, given that we want a different entrypoint per environment, we have to create some more files inside the lib directory.</p><ul><li>main_dev.dart</li><li>main_qat.dart</li><li>main_uat.dart</li><li>main_prod.dart</li></ul><p>When building or running the application, you just need to provide the entrypoint argument to the flutter command.</p><pre>flutter build apk <strong>--entrypoint </strong><em>lib/main_&lt;environment_name&gt;.dart</em></pre><p>Flutter will then take that entrypoint and start up the application using the configurations specified in that file.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQAaiRqqg5WWH95ySpd%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmemecandy-QAaiRqqg5WWH95ySpd&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FQAaiRqqg5WWH95ySpd%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="243" frameborder="0" scrolling="no"><a href="https://medium.com/media/93a1e422e1f7fa215624ef68dac6df9a/href">https://medium.com/media/93a1e422e1f7fa215624ef68dac6df9a/href</a></iframe><p>Well, take a look at the following code for our sample PROD environment.</p><pre>void main() {<br>  FlavorConfig(<br>      Flavor.PROD,<br>      FlavorValues(<br>          bffUrl: &#39;https://my-special.backend-service.com/v1&#39;,<br>          appId: &#39;https://my.id.com/&#39;),<br>      devToggles: &lt;String, bool&gt;{<br>        &#39;showDetailsPage&#39;: false,<br>        &#39;showNavigationBar&#39;: true,<br>        &#39;showExperimentalFeatureUsingMethodChannel&#39;: false<br>      });<br><br>  runApp(MyApp());<br>}</pre><p>We should change most, if not all, of the values for the other entrypoint files so they are properly configured for that environment. For instance, say you want your experimental features to show up only on your DEV and QAT environments but not in UAT or PROD as they are not ready to be shown to users yet. With these values set to false in the main_uat.dart and main_prod.dart files, you can build and deploy the app knowing that those users will not see those features.</p><p>As promised, this is a quick and easy way of building your flutter application to run in multiple environments.</p><h3>Pros and Cons</h3><p>Even though setting up the application for multiple environments is quick and easy, using flutter entrypoints does not mean it is always the best approach. Here are some quick tips on when you should and should not use this approach.</p><h4>Use:</h4><ul><li>You want to have a quick and painless way of prototyping an application that works for multiple environments</li><li>The codebase is small and you want to push your app as quickly as possible</li><li>You want to avoid the overhead of setting up the environments in your native code (through gradle/xcode)</li></ul><h4>Dont’ use:</h4><ul><li>If you are integrating any Firebase dependencies. Adding Firebase to your project rains on your entrypoint parade as you’ll soon find out in Part 2</li><li>You want to be able to install and use different environment versions of your application on a single device. By using entrypoints, all versions of your apps (DEV/QAT/etc) will share the same package name and that means they cannot exist simultaneously on the same device.</li></ul><p>Flutter entrypoints worked well for our team for a couple of months until we decided to integrate Firebase into our codebase. As a result of that, we had to pivot from using entrypoints to using <em>flavors</em>. In Part 2, I’ll go over why integrating with Firebase made us pivot and how to set up flavors for your Flutter app.</p><p>If you have any questions or if there is something that I am missing, feel free to leave a comment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be8de08ce331" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/flavorful-flutter-be8de08ce331">Flavorful Flutter</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>