<?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 Bertuğ Yılmaz on Medium]]></title>
        <description><![CDATA[Stories by Bertuğ Yılmaz on Medium]]></description>
        <link>https://medium.com/@bertugyilmaz?source=rss-c8f8ef54c858------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LkOrupTQfza69G9bgMkTjg.jpeg</url>
            <title>Stories by Bertuğ Yılmaz on Medium</title>
            <link>https://medium.com/@bertugyilmaz?source=rss-c8f8ef54c858------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:17:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bertugyilmaz/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[Flutter ile Ortam Yönetimi | Firebase Entegrasyonu]]></title>
            <link>https://medium.com/dogus-tech-digital-solutions/flutter-ile-ortam-y%C3%B6netimi-firebase-entegrasyonu-f6536c458299?source=rss-c8f8ef54c858------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6536c458299</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[flavor]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Bertuğ Yılmaz]]></dc:creator>
            <pubDate>Fri, 13 Nov 2020 12:23:09 GMT</pubDate>
            <atom:updated>2021-01-24T18:09:09.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SFFbo8lkNxVQcmLrLDVRNw.png" /></figure><p>Selamlar, bir önceki <a href="https://bertugyilmaz.medium.com/flutter-ile-ortam-y%C3%B6netimi-86082ae48202">yazımda</a> anlatmış olduğum ortam yönetimi konusunu Firebase SDK entegrasyonuyla zenginleştirmek istedim. Bu yazıda dev, uat ve production ortamları için Firebase uygulamaları oluşturup Flutter uygulamamızla entegre edeceğiz.</p><p>Firebase konsoldan bir proje oluşturalım. Development, uat, production birer iOS ve android uygulama oluşturalım. Oluşturduğumuz uygulamalara ait yapılandırma dosyalarını indirelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D_4XEiAuq02IMU5h4wS6LQ.png" /></figure><p><strong>pubspec.yaml</strong> dosyasının içerisine</p><pre>dependencies:   <br>  firebase_core: ^0.5.2<br>  ...</pre><p>firebase plugin’i ekleyelim ve <strong><em>flutter pub get</em></strong> komutunu terminal de kullanarak Firebase plugin’imizi yükleyelim.</p><p>Firebase servislerini kullanmaya başlamadan önce <strong>initializeApp </strong>metodunu çağırmalıyız.</p><pre><em>await</em> Firebase.initializeApp();</pre><p><strong>InitiliazeApp</strong> metodu async ve <em>Future&lt;FirebaseApp&gt;</em> tipinde bir dönüş değeri var. Bu nedenle uygulama akışınız başlamadan önce Firebase konfigürasyonlarının doğru olduğundan emin olmalıyız.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6b508c79096a709d5e14cebf5790089/href">https://medium.com/media/e6b508c79096a709d5e14cebf5790089/href</a></iframe><h3><strong>iOS</strong></h3><p>Runner target’ının altına ekran görüntüsündeki gibi dosya düzenimizi oluşturup ilgili <strong>GoogleServices.plist</strong> dosyalarını ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WLc4DyLt2RFRQRX7lW9HIQ.png" /></figure><p><em>Böyle bir hata mesajı ile karşılaşıcaksınız. Bu problem aynı isime sahip birden fazla kaynak dosyanın olmasından dolayı karşımıza çıkıyor. </em><strong><em>Runner&gt;Build Phases&gt; Copy Bundle Resources </em></strong><em>içerisinde bulunan iki dosyanın referansını kaldırarak bu problemi çözebiliriz</em> 🙃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pq_8tLzGgAzBiu6xHZWs6w.png" /></figure><p><strong>GoogleService-Info.plist</strong> dosyalarını ilgili ortam tipine göre kullanabilmek için her şemaya aşağıdaki gibi pre-action script ekleyeceğiz.</p><pre>cp -r &quot;${PROJECT_DIR}/Runner/&lt;dosya_yolu&gt;/GoogleService-Info.plist&quot; &quot;${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist&quot;</pre><h3><strong>Android</strong></h3><p>İlk olarak <strong>android/build.gradle </strong>içerisine</p><pre>buildscript {<br>  dependencies {<br>    // ... other dependencies<br>    <strong>classpath &#39;com.google.gms:google-services:4.3.3&#39;</strong><br>  }<br>}</pre><p>ve<strong> android/app/build.gradle </strong>içerisine</p><pre><strong>apply plugin: &#39;com.google.gms.google-services&#39;</strong></pre><p>bu satırları ekleyelim.</p><p><strong>android&gt;app&gt;src</strong> dosya yolu içerisinde ortam isimlerimizle klasörler oluşturup <strong>google-services.json</strong> dosyalarımızı ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*T_rKJqbvT_D6SKbEzr9CCg.png" /></figure><p>vee android için yapmamız gereken konfigürasyonları da tamamlamış oluyoruz 🎉</p><p>Temel Firebase entegrasyonumuzu tamamladık. Analytics, Firestore vb Firebase servislerini <strong>pubspec.yaml </strong>dosyanıza ekleyerek ortam değişkenlerinize bağlı olarak projenizde kullanabilirsiniz.</p><p>Kaynaklar:</p><ul><li><a href="https://firebase.flutter.dev/docs/overview">https://firebase.flutter.dev/docs/overview</a></li><li><a href="https://firebase.google.com/docs/projects/multiprojects">https://firebase.google.com/docs/projects/multiprojects</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6536c458299" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dogus-tech-digital-solutions/flutter-ile-ortam-y%C3%B6netimi-firebase-entegrasyonu-f6536c458299">Flutter ile Ortam Yönetimi | Firebase Entegrasyonu</a> was originally published in <a href="https://medium.com/dogus-tech-digital-solutions">Doğuş Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter ile Ortam Yönetimi]]></title>
            <link>https://medium.com/dogus-tech-digital-solutions/flutter-ile-ortam-y%C3%B6netimi-86082ae48202?source=rss-c8f8ef54c858------2</link>
            <guid isPermaLink="false">https://medium.com/p/86082ae48202</guid>
            <category><![CDATA[flavor]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Bertuğ Yılmaz]]></dc:creator>
            <pubDate>Fri, 06 Nov 2020 13:12:36 GMT</pubDate>
            <atom:updated>2021-01-24T18:08:58.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wqOKSMXeeqsKTZ10" /><figcaption>Photo by <a href="https://unsplash.com/@mattartz?utm_source=medium&amp;utm_medium=referral">Matt Artz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Bu yazı içeriğinde <strong><em>flutter_config</em></strong><em> p</em>lugin ve<strong> <em>flutter flavor</em></strong><em> </em>kullanarak development, production, uat, staging gibi farklı ortam konfigürasyonları ile çalıştırabildiğimiz bir flutter uygulaması yapıcağız.</p><p>İlk olarak ortam konfigürasyon değerlerinin bulunduğu <strong><em>.env</em></strong> ile başlayan dosyalarımızı proje ana dizinin de oluşturuyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UPIm8JoVlgPRtWxlg-7kww.png" /></figure><p><a href="https://pub.dev/packages/flutter_config"><strong><em>flutter_config</em></strong></a> plugin’i pubspec.yaml dosyamız içerisine ekleyip, proje dizininde</p><pre>$flutter pub get</pre><p>komutunu çalıştırıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hHvgRYiLByVlB1VjevJB9Q.png" /></figure><p>Flutter uygulamanız içerisinde bu konfigürasyon değerlerine erişebilmek için aşağıdaki gibi bir kaç kod parçası eklemeliyiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUwpQAbc9Js_OS9gBmyJoA.png" /></figure><p><strong>iOS</strong></p><p>iOS projemizi açalım. Ortamlarımız için şema oluşturup bunların konfigürasyon dosyalarını belirtmeliyiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rEOxwN3OATtUigdIqSfHuA.png" /></figure><p>Yukarıdaki görüntülediğiniz alanda <strong><em>New Scheme</em></strong><em> </em>tıklayarak yeni bir şema oluşturabilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9FLvFhILzqK8kvooaTmMyQ.png" /></figure><p>Debug, Profile ve Release build configuration dosyalarını oluşturduk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-hdMf58t2fjvik9X_2grg.png" /></figure><p>Şema ile ilişkili Build Configuration tipini belirtmeliyiz.</p><p>Bu oluşturduğumuz şemalara pre-actions script eklememiz gerekiyor. Bu script build aldığımız ortamın konfigürasyon dosyasını <strong><em>.envfile</em></strong> a yazıp daha sonra <strong><em>flutter_config</em></strong> plugin içerisindeki script’i kullanarak geçici bir config dosyasına yazıyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p-3CSSTBtIvM6iOaTzrqUw.png" /></figure><pre><strong>echo</strong> “.env.&lt;ortam_ismi&gt;” &gt; ${SRCROOT}/.envfile</pre><pre>${SRCROOT}/.symlinks/plugins/flutter_config/ios/Classes/BuildXCConfig.rb ${SRCROOT}/ ${SRCROOT}/Flutter/Temporary.xcconfig</pre><p>Script içerisinde belirttiğimiz <strong><em>Temporary.xcconfig</em></strong> dosyasını <strong><em>Debug.xcconfig</em></strong><em> </em>ve <strong><em>Release.xcconfig</em></strong><em> </em>dosyalarının içerisine include etmemiz gerekmektedir.</p><pre>#include? &quot;Temporary.xcconfig&quot;</pre><p>Artık oluşturduğumuz bu konfigürasyon değerlerini Xcode içerisinde;</p><pre>$(APP_ID)</pre><p>kod satırında da aşağıdaki şekilde kullanmamız mümkün 💪🏻</p><pre><strong>import</strong> flutter_config</pre><pre>...</pre><pre>  let appIdConfigKey = &quot;APP_ID&quot;</pre><pre>  let appIdValue = FlutterConfigPlugin.env(for: appIdConfigKey)</pre><pre>...</pre><p><strong>Android</strong></p><p><strong><em>android/app/build.gradle</em></strong><em> </em>dizini içerisine gidelim.</p><pre>android { <br>...</pre><pre>   flavorDimensions &quot;flavors&quot;</pre><pre>   productFlavors {<br>     development {<br>      dimension &quot;flavors&quot;<br>     }<br>     uat {<br>      dimension &quot;flavors&quot;<br>     }<br>     production {<br>      dimension &quot;flavors&quot;<br>     }<br>   }</pre><pre>}</pre><p>Ortam isimlerimize göre productFlavors oluşturduk.</p><p>İçerisinde bulunduğunuz build.gradle dosyasında apply from: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot; kod satırının altına aşağıdaki kod satırlarını eklemeniz gerekmektedir.</p><pre>project.ext.envConfigFiles = [<br>  developmentdebug: &quot;.env.development&quot;,<br>  developmentrelease: &quot;.env.development&quot;,<br>  uatdebug: &quot;.env.uat&quot;,<br>  uatrelease: &quot;.env.uat&quot;,<br>  productiondebug: &quot;.env.production&quot;,<br>  productionrelease: &quot;.env.production&quot;,<br>]</pre><pre>apply from: project(&#39;:flutter_config&#39;).projectDir.getPath() + &quot;/dotenv.gradle&quot;</pre><p><strong>.gradle</strong> dosyasında kullanım için;</p><pre>defaultConfig {<br>  applicationId <strong>project.env.get(&quot;APP_ID&quot;)</strong><br>  minSdkVersion 23<br>  targetSdkVersion 28<br>  versionCode flutterVersionCode.toInteger()<br>  versionName flutterVersionName<br>  resValue &quot;string&quot;, &quot;app_name&quot;, <strong>project.env.get(&quot;APP_NAME&quot;)</strong><br>}</pre><p>kod satırında ise aşağıdaki şekilde kullanabiliriz.</p><pre>fun getApiClient(): HttpURLConnection {<br>    val url = URL(BuildConfig.API_URL);<br>    // ...<br>}</pre><p>Hem iOS hem Android uygulamamız için ayrı ayrı düzenlemelerimizi yaptık. Artık flutter run --flavor development gibi ortam ismini belirterek uygulamamızı farklı konfigürasyonlarda ayağa kaldırabiliriz 🎉</p><p><a href="https://github.com/bertugyilmaz/flutter-multiple-environment-sample">bertugyilmaz/flutter-multiple-environment-sample</a></p><p>Bu yazının devamı olarak Firebase entegrasyonunu anlattığım yazı için <a href="https://bertugyilmaz.medium.com/flutter-ile-ortam-y%C3%B6netimi-firebase-entegrasyonu-f6536c458299">tıklayınız.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86082ae48202" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dogus-tech-digital-solutions/flutter-ile-ortam-y%C3%B6netimi-86082ae48202">Flutter ile Ortam Yönetimi</a> was originally published in <a href="https://medium.com/dogus-tech-digital-solutions">Doğuş Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>