<?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 Koki Yoshida on Medium]]></title>
        <description><![CDATA[Stories by Koki Yoshida on Medium]]></description>
        <link>https://medium.com/@lllttt06?source=rss-c822a740da39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rkO1f9DV64QerZc7K9k81g.jpeg</url>
            <title>Stories by Koki Yoshida on Medium</title>
            <link>https://medium.com/@lllttt06?source=rss-c822a740da39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:26:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lllttt06/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[Codex setup scripts for Flutter]]></title>
            <link>https://medium.com/@lllttt06/codex-setup-scripts-for-flutter-86afd9e71349?source=rss-c822a740da39------2</link>
            <guid isPermaLink="false">https://medium.com/p/86afd9e71349</guid>
            <category><![CDATA[codice]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Koki Yoshida]]></dc:creator>
            <pubDate>Thu, 22 May 2025 11:42:22 GMT</pubDate>
            <atom:updated>2025-05-22T11:42:22.414Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://platform.openai.com/docs/codex#setup-scripts">Codex</a> is a cloud-based software engineering agent released by OpenAI.<br>It edits our code cloning to the sandbox offline environment.</p><p>Because it is all executed in offline environment, we firstly setup some tools soon after Codex cloning our repository.</p><p><a href="https://platform.openai.com/docs/codex#setup-scripts">https://platform.openai.com/docs/codex#setup-scripts</a></p><p>Here is the sample setup script for Flutter.</p><pre>#!/bin/bash<br>set -ex<br><br>FLUTTER_SDK_INSTALL_DIR=&quot;$HOME/flutter&quot;<br>git clone https://github.com/flutter/flutter.git -b stable &quot;$FLUTTER_SDK_INSTALL_DIR&quot;<br>ORIGINAL_PWD=$(pwd)<br>cd &quot;$FLUTTER_SDK_INSTALL_DIR&quot;<br>git fetch --tags<br>git checkout 3.29.3<br>cd &quot;$ORIGINAL_PWD&quot;<br><br>BASHRC_FILE=&quot;/root/.bashrc&quot;<br>FLUTTER_PATH_EXPORT_LINE=&quot;export PATH=\&quot;$FLUTTER_SDK_INSTALL_DIR/bin:\$PATH\&quot;&quot;<br>echo &quot;$FLUTTER_PATH_EXPORT_LINE&quot; &gt;&gt; &quot;$BASHRC_FILE&quot;<br>export PATH=&quot;$FLUTTER_SDK_INSTALL_DIR/bin:$PATH&quot;<br><br>flutter precache<br><br># Use your own project name<br>PROJECT_DIR=&quot;/workspace/[my_app]&quot;<br><br>cd &quot;$PROJECT_DIR&quot;<br>flutter pub get<br>flutter gen-l10n<br>flutter packages pub run build_runner build --delete-conflicting-outputs</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86afd9e71349" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Devtools Extensions Use Cases]]></title>
            <link>https://medium.com/@lllttt06/flutter-devtools-extensions-use-cases-08f15e236edf?source=rss-c822a740da39------2</link>
            <guid isPermaLink="false">https://medium.com/p/08f15e236edf</guid>
            <category><![CDATA[apollo-client]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[devtools]]></category>
            <dc:creator><![CDATA[Koki Yoshida]]></dc:creator>
            <pubDate>Sun, 08 Dec 2024 01:56:26 GMT</pubDate>
            <atom:updated>2024-12-08T01:56:26.759Z</atom:updated>
            <content:encoded><![CDATA[<h3>👀 Introduction</h3><p>This article summarizes the content of my talk at <a href="https://2024.flutterkaigi.jp/"><strong>FlutterKaigi 2024</strong></a>. For more details, you can check the following video and slides (in Japanese):</p><ul><li><a href="https://www.youtube.com/live/CE0NTGJLbS8?si=i_06Ifsg3mBXQvuT&amp;t=25301">Video</a></li><li><a href="https://speakerdeck.com/kokiyoshida/devtools-extensions-de-du-zi-no-devtool-wokai-fa-suru-flutterkaigi-2024">Speaker Deck</a></li></ul><p>You can also check the sample repository here.</p><p><a href="https://github.com/lllttt06/flutter_devtools_extension_sample">https://github.com/lllttt06/flutter_devtools_extension_sample</a></p><h3>🚀 What are DevTools Extensions?</h3><p><a href="https://pub.dev/packages/devtools_extensions">DevTools Extensions</a> allow you to create custom functionality and extend DevTools. When created, a new tab like flutterkaigi is automatically generated, integrating with DevTools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fPh0I4gMZwaCnIKD.png" /></figure><p>DevTools Extensions offer several benefits and are a powerful tool for Flutter developers to enhance productivity:</p><ul><li>Can be created with Flutter Web</li><li>Can be integrated with existing packages, and also published as independent packages</li><li>Reuses the existing DevTools infrastructure</li></ul><h3>🐬 Use Cases for DevTools Extensions</h3><p>In our team, we have created several useful features with DevTools Extensions. You can check out the sample repository for these features:</p><p><a href="https://github.com/lllttt06/flutter_devtools_extension_sample">Sample Repository</a></p><h3>GraphQL Cache Inspector</h3><p>Our app uses GraphQL for fetching data, and we use the <a href="https://pub.dev/packages/graphql_flutter">graphql_flutter</a> package on the client side. Since this package does not have a built-in mechanism to inspect the client cache, we created a feature for inspecting the cache using DevTools Extensions, inspired by <a href="https://www.apollographql.com/docs/react/development-testing/developer-tooling">Apollo Client</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3AwaQOVU0B6TZeDmfNdkg.png" /></figure><p>In this sample app, it gets pokemon’s data using GraphQL API, and the Devtool extension shows the normalized client cache. You can see the querys and mutations in this GraphQL Cache Inspector.</p><h3>Loading State Toggle</h3><p>This feature allows you to easily check the loading state UI. Normally, the loading UI is very brief, so this feature allows you to toggle the loading state and visualize it. This feature is inspired by React’s <a href="https://react-devtools-tutorial.vercel.app/toggling-suspense-fallbacks">Suspense</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2tP98yy1PExFgZAz4stXw.png" /><figcaption>isLoading == false</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jNHbY3_4o7kbobU_LQGqfQ.png" /><figcaption>isLoading == true, then shows loading UI</figcaption></figure><p>The architecture is quite simple. We define DebugLoadingState and if the state is true, GraphQLQueryContainer returns loading UI even though the query result is already completed or not.</p><pre>@Riverpod(keepAlive: true, dependencies: [])<br>class DebugLoadingState extends _$DebugLoadingState {<br>  @override<br>  bool build() =&gt; false;<br><br>  void update({required bool isLoading}) {<br>    if (kReleaseMode) return;<br>    state = isLoading;<br>  }<br>}<br><br>class GraphQLQueryContainer&lt;TParsed&gt; extends HookConsumerWidget {<br>  // ...<br><br>  @override<br>  Widget build(BuildContext context, WidgetRef ref) {<br>    final isLoadingForDebug = ref.watch(debugLoadingStateProvider);<br>    final result = query.result;<br><br>    if (isLoadingForDebug) {<br>      // Loading (Debug)<br>      return onLoadingWidget;<br>    }<br><br>    if (result.hasException &amp;&amp; onErrorWidget != null) {<br>      // Error<br>      return onErrorWidget;<br>    } else if (result.data == null &amp;&amp; result.isNotLoading) {<br>      // Empty<br>      return onEmptyWidget;<br>    } else if (result.data == null &amp;&amp; result.isLoading) {<br>      // Loading<br>      return onLoadingWidget;<br>    } else {<br>      // Completed<br>      return child(result.parsedData as TParsed);<br>    }<br>  }<br>}</pre><p>The screen which uses GraphQLQueryContainer is like this.</p><pre>class HomeScreen extends HookWidget {<br>  const HomeScreen({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    final query = useQuery$pokemons();<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: GestureDetector(child: const Text(&#39;Demo App&#39;)),<br>      ),<br>      body: GraphQLQueryContainer(<br>        query: query,<br>        onLoadingWidget: onLoadingWidget,<br>        child: (data) {<br>          return ListView.separated(<br>            // ...<br>          );<br>        },<br>      ),<br>    );<br>  }<br>}</pre><h3>Dio Logger Toggle</h3><p>We use Dio as our HTTP client and typically output communication logs to the debug console during development. However, sometimes too many logs can make it difficult to view other information. This feature allows us to toggle the log output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDzgWBLiOjS9qOHgWh9mnA.png" /></figure><h3>🤖 How to Create a DevTools Extension</h3><p>Creating a DevTools Extension is straightforward and not so difficult:</p><ol><li>Create a config.yaml file</li><li>Create a DevTools Extension package with Flutter Web</li><li>Build the extension with Flutter Web</li></ol><p>For more details, refer to these great articles:</p><ul><li><a href="https://medium.com/flutter/dart-flutter-devtools-extensions-c8bc1aaf8e5f">https://medium.com/flutter/dart-flutter-devtools-extensions-c8bc1aaf8e5f</a></li><li><a href="https://medium.com/@lennarddeurman/exploring-fluters-new-custom-devtools-extensions-f0e42567d5ae">https://medium.com/@lennarddeurman/exploring-fluters-new-custom-devtools-extensions-f0e42567d5ae</a></li></ul><h3>🌙 Tips for Creating Devtools Extension</h3><p>To develop Devtools Extension, you can use three useful global variables: ExtensionManager, ServiceManager, and DTDManager:</p><ul><li><a href="https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/lib/src/template/extension_manager.dart"><strong>ExtensionManager</strong></a>: For managing notifications (banners, snackbars) in DevTools</li><li><a href="https://github.com/flutter/devtools/blob/master/packages/devtools_app_shared/lib/src/service/service_manager.dart"><strong>ServiceManager</strong></a>: For interacting with the VM Service</li><li><a href="https://github.com/flutter/devtools/blob/master/packages/devtools_app_shared/lib/src/service/dtd_manager.dart"><strong>DTDManager</strong></a>: For working with the file system (Honestly I don’t fully understand this feature…)</li></ul><p>You can overwrite project files from Devtools Extension, using DTDManager. This image shows the extension changes the App theme to dark mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xk4f-AJxRW2n8UcOo7aBNA.png" /></figure><p><a href="https://github.com/lllttt06/flutter_devtools_extension_sample/blob/main/packages/devtools_ext/lib/ui/utils/utils.dart">https://github.com/lllttt06/flutter_devtools_extension_sample/blob/main/packages/devtools_ext/lib/ui/utils/utils.dart</a></p><h3>📝 Conclusion</h3><p>DevTools Extensions are a powerful feature that allows you to create custom functionality for Flutter’s development tools. This enables the addition of tailored debugging features for your app, greatly improving the development process.</p><p>Creating DevTools Extensions is simple and involves defining a configuration file (config.yaml), creating a package with Flutter Web, and building the extension. When integrated with a running app, you can enhance its functionality even further.</p><p>DevTools Extensions enrich the Flutter development environment and provide more customization options for your projects. If you’re interested, you can check out the sample repository and start experimenting with these powerful tools.</p><p>Additionally, by drawing inspiration from web technologies, it’s easier to come up with ideas to improve the Flutter developer experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08f15e236edf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter development with Neovim]]></title>
            <link>https://medium.com/@lllttt06/flutter-development-with-neovim-7e45669aac53?source=rss-c822a740da39------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e45669aac53</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[lua]]></category>
            <category><![CDATA[neovim]]></category>
            <dc:creator><![CDATA[Koki Yoshida]]></dc:creator>
            <pubDate>Sun, 30 Jun 2024 09:15:14 GMT</pubDate>
            <atom:updated>2024-06-30T09:15:14.836Z</atom:updated>
            <content:encoded><![CDATA[<p>This guide helps you set up and use Neovim for Flutter development. The Neovim version is v0.10.0, and the plugin manager is <a href="https://github.com/folke/lazy.nvim">lazy.nvim</a>. You can find my dotfiles <a href="https://github.com/lllttt06/dotfiles/tree/main/nvim">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MfRA8vPVLeobBst3c5CO4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uw_S48NK05FExjZR4ZAFTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5nzqdexmKlVXHMHK8rN8w.png" /></figure><p><strong>Neovim Plugins for Flutter</strong><br>For Flutter development, the [flutter-tools.nvim](<a href="https://github.com/akinsho/flutter-tools.nvim">https://github.com/akinsho/flutter-tools.nvim</a>) plugin is very helpful. If you do not need a debugger, you can use just flutter-tools without installing nvim-dap. Here is the relevant configuration snippet:</p><pre> -- debugger<br>    {<br>        &quot;mfussenegger/nvim-dap&quot;,<br>        dependencies = {<br>            &#39;nvim-neotest/nvim-nio&#39;,<br>            &#39;rcarriga/nvim-dap-ui&#39;,<br>        },<br>        event = &#39;VeryLazy&#39;,<br>        config = function()<br>            require(&quot;dapui&quot;).setup({<br>                icons = { expanded = &quot;▾&quot;, collapsed = &quot;▸&quot; },<br>                layouts = {<br>                    {<br>                        elements = {<br>                            { id = &quot;scopes&quot;, size = 0.25 },<br>                            &quot;breakpoints&quot;,<br>                            &quot;stacks&quot;,<br>                            &quot;watches&quot;,<br>                        },<br>                        size = 10, -- columns<br>                        position = &quot;bottom&quot;,<br>                    },<br>                },<br>            })<br>        end<br>    },<br><br>    -- flutter<br>    {<br>        &quot;akinsho/flutter-tools.nvim&quot;,<br>        event = &quot;VeryLazy&quot;,<br>        dependencies = {<br>            &quot;nvim-lua/plenary.nvim&quot;,<br>            &quot;stevearc/dressing.nvim&quot;,<br>        },<br>        config = function()<br>            require(&quot;flutter-tools&quot;).setup {<br>                flutter_path = nil,<br>                flutter_lookup_cmd = &quot;asdf where flutter&quot;,<br>                fvm = false,<br>                widget_guides = { enabled = true },<br>                lsp = {<br>                    settings = {<br>                        showtodos = true,<br>                        completefunctioncalls = true,<br>                        analysisexcludedfolders = {<br>                            vim.fn.expand(&quot;$Home/.pub-cache&quot;),<br>                        },<br>                        renamefileswithclasses = &quot;prompt&quot;,<br>                        updateimportsonrename = true,<br>                        enablesnippets = false,<br>                    },<br>                },<br>                debugger = {<br>                    enabled = true,<br>                    run_via_dap = true,<br>                    exception_breakpoints = {},<br>                    register_configurations = function(paths)<br>                        local dap = require(&quot;dap&quot;)<br>                        -- See also: https://github.com/akinsho/flutter-tools.nvim/pull/292<br>                        dap.adapters.dart = {<br>                            type = &quot;executable&quot;,<br>                            command = paths.flutter_bin,<br>                            args = { &quot;debug-adapter&quot; },<br>                        }<br>                        dap.configurations.dart = {}<br>                        require(&quot;dap.ext.vscode&quot;).load_launchjs()<br>                    end,<br>                },<br>            }<br>        end<br>    },</pre><p>As mentioned in this <a href="https://github.com/akinsho/flutter-tools.nvim?tab=readme-ov-file#flutter-binary">section</a>, you should set up <em>flutter_lookup_command to </em>use <a href="https://asdf-vm.com/">asdf</a> or something like that.</p><p>If you are using nvim-dap for debugging, you can refer to the configurations in .vscode/launch.json by setting up require(&quot;dap.ext.vscode&quot;).load_launchjs().</p><pre>json<br>// .vscode/launch.json<br>{<br>  &quot;version&quot;: &quot;0.0.1&quot;,<br>  &quot;configurations&quot;: [<br>    {<br>      &quot;name&quot;: &quot;Run app for Dev&quot;,<br>      &quot;program&quot;: &quot;${workspaceFolder}/lib/main.dart&quot;,<br>      &quot;request&quot;: &quot;launch&quot;,<br>      &quot;type&quot;: &quot;dart&quot;,<br>      &quot;flutterMode&quot;: &quot;debug&quot;,<br>      &quot;args&quot;: [<br>        &quot;--debug&quot;,<br>        &quot;--flavor&quot;,<br>        &quot;dev&quot;,<br>        &quot;--dart-define-from-file=define/flavor/dev/common.json&quot;,<br>        &quot;--dart-define-from-file=define/flavor/dev/firebase_options.json&quot;<br>      ]<br>    },<br>    {<br>      &quot;name&quot;: &quot;Run app for Prd&quot;,<br>      &quot;program&quot;: &quot;${workspaceFolder}/lib/main.dart&quot;,<br>      &quot;request&quot;: &quot;launch&quot;,<br>      &quot;type&quot;: &quot;dart&quot;,<br>      &quot;flutterMode&quot;: &quot;debug&quot;,<br>      &quot;args&quot;: [<br>        &quot;--debug&quot;,<br>        &quot;--flavor&quot;,<br>        &quot;prd&quot;,<br>        &quot;--dart-define-from-file=define/flavor/prd/common.json&quot;,<br>        &quot;--dart-define-from-file=define/flavor/prd/firebase_options.json&quot;<br>      ]<br>    }<br>  ]<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uw_S48NK05FExjZR4ZAFTg.png" /></figure><p><strong>Other Recommended Neovim Plugins</strong></p><ul><li><a href="https://github.com/echasnovski/mini.files">mini.files</a><br>This is a file explorer plugin. I previously used <a href="https://github.com/nvim-tree/nvim-tree.lua">nvim-tree.lua</a>, but switched to mini.files for its unique UI/UX.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MdbAXVZeF8FY7AxhMP1M4w.png" /></figure><ul><li><a href="https://github.com/shortcuts/no-neck-pain.nvim">no-neck-pain.nvim</a><br>This plugin centers the buffer on the screen. By using this plugin, I realized that I don’t need to keep the file explorer open all the time, which complements the mini.files plugin.</li><li><a href="https://github.com/shellRaining/hlchunk.nvim">hlchunk.nvim</a><br>This plugin highlights code chunks dynamically, making it visually appealing and easier to follow nested code blocks.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cub0weG9DF03v2vFQqc_zA.png" /></figure><p>I hope this guide helps increase the number of Vimmer. Happy coding with Neovim and Flutter!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e45669aac53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use XcodeGen for Flutter Project]]></title>
            <link>https://medium.com/@lllttt06/use-xcodegen-for-flutter-project-6084b695a7b6?source=rss-c822a740da39------2</link>
            <guid isPermaLink="false">https://medium.com/p/6084b695a7b6</guid>
            <category><![CDATA[xcodegen]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Koki Yoshida]]></dc:creator>
            <pubDate>Wed, 19 Jun 2024 00:29:19 GMT</pubDate>
            <atom:updated>2024-06-19T00:33:27.396Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>I have created a sample repository for generating ios/Runner.xcodeproj using <a href="https://github.com/yonaskolb/XcodeGen">XcodeGen</a> for Flutter.</p><p><a href="https://github.com/lllttt06/xcodegen_flutter_sample">GitHub - lllttt06/xcodegen_flutter_sample: A Flutter sample repository using XcodeGen</a></p><p>The project.yml is configured to switch between the following for the two flavors dev and prd:<br>- App icon<br>- App display name<br>- Bundle ID<br>- Firebase Project</p><h3>The Pain of project.pbxproj</h3><p>When developing iOS apps with Flutter, there are times when you need to open and edit in Xcode. After editing with Xcode’s GUI, you might see incomprehensible diffs in ios/Runner.xcodeproj/project.pbxproj like this:</p><figure><img alt="From https://github.com/react-native-community/cli/issues/652" src="https://cdn-images-1.medium.com/max/1024/0*d9rwNd__8ERnBZMC.png" /></figure><p>In iOS development, multiple people operating Xcode often lead to conflicts in this file. One tool to solve this problem is XcodeGen.</p><h3>What is XcodeGen?</h3><p>XcodeGen is a tool that generates .xcodeproj from yml files like project.yml. In Flutter, the files generated by flutter create under ios/Runner.xcodeproj fall into this category.</p><pre>yaml:project.yml<br>name: Runner<br>options:<br>  xcodeVersion: &#39;15.4.0&#39;<br>  developmentLanguage: ja<br>  deploymentTarget:<br>    iOS: 16.0<br>include:<br>  - xcodegen/setting/base.yml<br>configs:<br>  Debug: Debug<br>  Debug-dev: Debug-dev<br>  Debug-prd: Debug-prd<br>  Profile: Profile<br>  Profile-dev: Profile-dev<br>  Profile-prd: Profile-prd<br>  Release: Release<br>  Release-dev: Release-dev<br>  Release-prd: Release-prd<br>...</pre><p>For detailed usage and explanations of XcodeGen, please refer to the many available articles.</p><h3>Comparison with SPM (Swift Package Manager)</h3><p>As of June 2024, using SPM is becoming more popular in the iOS community as a solution to similar problems. There is also a <a href="https://github.com/flutter/flutter/pull/146256">PR</a> in Flutter for SPM support.<br>However, as of Flutter v3.22.0, it cannot be used, and if the package does not support it, CocoaPods must be used together, so we did not adopt it this time.</p><h3>Using XcodeGen in Flutter Development</h3><p>Although project.pbxproj rarely conflicts in Flutter development, the diffs could be complex and make PR reviews difficult. Most XcodeGen articles and information are for native iOS development, so I created a sample repository for using XcodeGen in Flutter development.</p><p><a href="https://github.com/lllttt06/xcodegen_flutter_sample">GitHub - lllttt06/xcodegen_flutter_sample: A Flutter sample repository using XcodeGen</a></p><p>This repository creates a project.yml to generate .xcodeproj for a Flutter app with two flavors, dev and prd. It separates the following elements for each flavor, assuming common Flutter use cases:<br>- App icon<br>- App display name<br>- Bundle ID<br>- Firebase ProjectUsage is simple; after preparing the tools defined in .tool-versions (this repository uses [asdf](<a href="https://asdf-vm.com/">https://asdf-vm.com/</a>)), just run the following commands to create .xcodeproj and run the app.</p><pre>sh<br>cd ios &amp;&amp; xcodegen generate<br>flutter run --flavor dev(or prd)</pre><h3>XcodeGen File Structure</h3><p>The file structure related to XcodeGen is as follows:</p><pre>ios<br>├── project.yml<br>└── xcodegen<br>   ├── script<br>   │ ├── check_pods_manifest.sh<br>   │ ├── copy_pods_resources.sh<br>   │ ├── crashlytics_upload_symbols.sh<br>   │ ├── embed_pods_frameworks.sh<br>   │ ├── run_script.sh<br>   │ ├── select_google_service_info_plist.sh<br>   │ └── thin_binary.sh<br>   └── setting<br>      ├── base.yml<br>      ├── debug-dev.yml<br>      ├── debug-prd.yml<br>      ├── debug.yml<br>      ├── profile-dev.yml<br>      ├── profile-prd.yml<br>      ├── profile.yml<br>      ├── release-dev.yml<br>      ├── release-prd.yml<br>      └── release.yml</pre><p>In ios/xcodegen/script/, the scripts defined in the Build Phases tab of Xcode are extracted.</p><pre>#!/bin/sh<br><br>/bin/sh &quot;$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh&quot; build</pre><figure><img alt="Build Phase Tab in Xcode" src="https://cdn-images-1.medium.com/max/1024/0*S9uge_9itxBTC090.png" /></figure><p>In ios/xcodegen/setting/, the contents of the Build Settings tab for each config are described. base.yml handles the inclusion of values for each config and the description of common settings.</p><pre><br>include:<br>  - path: &#39;./debug-dev.yml&#39;<br>    relativePath: true<br>  - path: &#39;./release-dev.yml&#39;<br>    relativePath: true<br>  - path: &#39;./profile-dev.yml&#39;<br>    relativePath: true<br>  - path: &#39;./debug-prd.yml&#39;<br>    relativePath: true<br>  - path: &#39;./profile-prd.yml&#39;<br>    relativePath: true<br>  - path: &#39;./release-prd.yml&#39;<br>    relativePath: true<br>  - path: &#39;./debug.yml&#39;<br>    relativePath: true<br>  - path: &#39;./profile.yml&#39;<br>    relativePath: true<br>  - path: &#39;./release.yml&#39;<br>    relativePath: true<br><br>settings:<br>  base:<br>    ALWAYS_SEARCH_USER_PATHS: NO<br>    ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: YES<br>    CLANG_ANALYZER_NONNULL: YES<br>    CLANG_CXX_LANGUAGE_STANDARD: &#39;gnu++0x&#39;<br>    CLANG_CXX_LIBRARY: &#39;libc++&#39;<br>    CLANG_ENABLE_MODULES: YES<br>    CLANG_ENABLE_OBJC_ARC: YES<br>    CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING: YES<br>    CLANG_WARN_BOOL_CONVERSION: YES<br>    CLANG_WARN_COMMA: YES<br>    CLANG_WARN_CONSTANT_CONVERSION: YES<br>    CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS: YES<br>    CLANG_WARN_DIRECT_OBJC_ISA_USAGE: YES_ERROR<br>    CLANG_WARN_EMPTY_BODY: YES<br>    CLANG_WARN_ENUM_CONVERSION: YES<br>    CLANG_WARN_INFINITE_RECURSION: YES<br>    CLANG_WARN_INT_CONVERSION: YES<br>    CLANG_WARN_NON_LITERAL_NULL_CONVERSION: YES<br>    CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF: YES<br>    CLANG_WARN_OBJC_LITERAL_CONVERSION: YES<br>    CLANG_WARN_OBJC_ROOT_CLASS: YES_ERROR<br>    CLANG_WARN_RANGE_LOOP_ANALYSIS: YES<br>    CLANG_WARN_STRICT_PROTOTYPES: YES<br>    CLANG_WARN_SUSPICIOUS_MOVE: YES<br>    CLANG_WARN_UNREACHABLE_CODE: YES<br>    CLANG_WARN__DUPLICATE_METHOD_MATCH: YES<br>    &#39;CODE_SIGN_IDENTITY[sdk=iphoneos*]&#39;: &#39;iPhone Developer&#39;<br>    COPY_PHASE_STRIP: NO<br>    ENABLE_STRICT_OBJC_MSGSEND: YES<br>    ENABLE_USER_SCRIPT_SANDBOXING: NO<br>    GCC_C_LANGUAGE_STANDARD: gnu99<br>    GCC_NO_COMMON_BLOCKS: YES<br>    GCC_WARN_64_TO_32_BIT_CONVERSION: YES<br>    GCC_WARN_ABOUT_RETURN_TYPE: YES_ERROR<br>    GCC_WARN_UNDECLARED_SELECTOR: YES<br>    GCC_WARN_UNINITIALIZED_AUTOS: YES_AGGRESSIVE<br>    GCC_WARN_UNUSED_FUNCTION: YES<br>    GCC_WARN_UNUSED_VARIABLE: YES<br>    SDKROOT: iphoneos<br>    TARGETED_DEVICE_FAMILY: &#39;1,2&#39;</pre><p>The overall structure of the main project.yml is as follows. For detailed explanations of each item, refer to the <a href="https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md">official documentation</a>.</p><pre>name: Runner<br><br>options:<br>  xcodeVersion: &#39;15.4.0&#39;<br>  developmentLanguage: ja<br>  deploymentTarget:<br>    iOS: 16.0<br><br>include:<br>  - xcodegen/setting/base.yml<br><br>configs:<br>  Debug: Debug<br>  Debug-dev: Debug-dev<br>  Debug-prd: Debug-prd<br>  Profile: Profile<br>  Profile-dev: Profile-dev<br>  Profile-prd: Profile-prd<br>  Release: Release<br>  Release-dev: Release-dev<br>  Release-prd: Release-prd<br><br>targets:<br>  Runner:<br>    type: application<br>    platform: iOS<br>    configFiles:<br>      Debug: Flutter/Debug.xcconfig<br>      Debug-dev: Flutter/Debug.xcconfig<br>      Debug-prd: Flutter/Debug.xcconfig<br>      Profile: Flutter/Profile.xcconfig<br>      Profile-dev: Flutter/Profile.xcconfig<br>      Profile-prd: Flutter/Profile.xcconfig<br>      Release: Flutter/Release.xcconfig<br>      Release-dev: Flutter/Release.xcconfig<br>      Release-prd: Flutter/Release.xcconfig<br><br>    sources:<br>      # - GoogleService-Info.plist<br>      - Flutter/AppFrameworkInfo.plist<br>      - Flutter/Generated.xcconfig<br>      - Flutter/Debug.xcconfig<br>      - Flutter/Profile.xcconfig<br>      - Flutter/Release.xcconfig<br>      - path: Runner/<br><br>    dependencies:<br>      - sdk: Pods_Runner.framework<br>        embed: false<br>        link: true<br><br>    preBuildScripts:<br>      - name: &#39;[CP] Check Pods Manifest.lock&#39;<br>        path: xcodegen/script/check_pods_manifest.sh<br>        inputFiles:<br>          - ${PODS_PODFILE_DIR_PATH}/Podfile.lock<br>          - ${PODS_ROOT}/Manifest.lock<br>        outputFiles:<br>          - $(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt<br>      - name: Run Script<br>        path: xcodegen/script/run_script.sh<br><br>    # If you use different Firebase Project for each environment, you can use this script.<br>    # postCompileScripts:<br>    #   - name: Select GoogleService-Info.plist<br>    #     path: xcodegen/script/select_google_service_info_plist.sh<br>    #     outputFiles:<br>    #       - ${SRCROOT}/GoogleService-Info.plist<br><br>    postBuildScripts:<br>      - name: Thin Binary<br>        path: xcodegen/script/thin_binary.sh<br>        inputFiles:<br>          - ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}<br><br>      # If you use Firebase Crashlytics, you can use this script.<br>      # - name: &#39;[firebase_crashlytics] Crashlytics Upload Symbols&#39;<br>      #   path: xcodegen/script/crashlytics_upload_symbols.sh<br>      #   inputFiles:<br>      #     - ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}<br>      #     - ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}<br>      #     - ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist<br>      #     - $(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist<br>      #     - $(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)<br><br><br>    settings:<br>      base:<br>        ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: NO<br>        CLANG_ENABLE_MODULES: YES<br>        CURRENT_PROJECT_VERSION: &#39;$(FLUTTER_BUILD_NUMBER)&#39;<br>        # TODO: DEVELOPMENT_TEAM<br>        # DEVELOPMENT_TEAM: YOUR_TEAM_ID<br>        ENABLE_BITCODE: NO<br>        INFOPLIST_FILE: Runner/Info.plist<br>        SWIFT_OBJC_BRIDGING_HEADER: &#39;Runner/Runner-Bridging-Header.h&#39;<br>        SWIFT_VERSION: 5.0<br>        VERSIONING_SYSTEM: &#39;apple-generic&#39;<br>      configs:<br>        Profile-prd:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-prd&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample<br>          PRODUCT_NAME: &#39;PRD&#39;<br><br>        Profile-dev:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-dev&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample.dev<br>          PRODUCT_NAME: &#39;DEV&#39;<br><br>        Release-prd:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-prd&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample<br>          PRODUCT_NAME: &#39;PRD&#39;<br><br>        Release-dev:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-dev&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample.dev<br>          PRODUCT_NAME: &#39;DEV&#39;<br><br>        Debug-prd:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-prd&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample<br>          PRODUCT_NAME: &#39;PRD&#39;<br>          SWIFT_OPTIMIZATION_LEVEL: &#39;-Onone&#39;<br><br>        Debug-dev:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-dev&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample.dev<br>          PRODUCT_NAME: &#39;DEV&#39;<br>          SWIFT_OPTIMIZATION_LEVEL: &#39;-Onone&#39;<br><br>        Debug:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-prd&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample<br>          PRODUCT_NAME: &#39;NONE&#39;<br>          SWIFT_OPTIMIZATION_LEVEL: &#39;-Onone&#39;<br><br>        Release:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-prd&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample<br>          PRODUCT_NAME: &#39;NONE&#39;<br><br>        Profile:<br>          ASSETCATALOG_COMPILER_APPICON_NAME: &#39;AppIcon-prd&#39;<br>          PRODUCT_BUNDLE_IDENTIFIER: com.example.flutterXcodegenSample<br>          PRODUCT_NAME: &#39;NONE&#39;<br><br><br>schemes:<br>  Runner:<br>    build:<br>      targets:<br>        Runner: all<br>    run:<br>      config: Debug<br>    test:<br>      config: Debug<br>    profile:<br>      config: Profile<br>    analyze:<br>      config: Debug<br>    archive:<br>      config: Release<br>  dev:<br>    build:<br>      targets:<br>        Runner: all<br>    run:<br>      config: Debug-dev<br>    test:<br>      config: Debug-dev<br>    profile:<br>      config: Profile-dev<br>    analyze:<br>      config: Debug-dev<br>    archive:<br>      config: Release-dev<br>  prd:<br>    build:<br>      targets:<br>        Runner: all<br>    run:<br>      config: Debug-prd<br>    test:<br>      config: Debug-prd<br>    profile:<br>      config: Profile-prd<br>    analyze:<br>      config: Debug-prd<br>    archive:<br>      config: Release-prd</pre><h3>Separating Firebase Projects by Flavor</h3><p>After setting up the Firebase project, place the GoogleService-Info.plist you want to use for each flavor under ios/GoogleService/{Flavor}. Additionally, you need to run a script to copy the GoogleService-Info.plist for each flavor to ios/ during the build. The settings for this are commented out, so uncomment them as needed.</p><pre># If you use different Firebase Project for each environment, you can use this script.<br># postCompileScripts:<br>#   - name: Select GoogleService-Info.plist<br>#     path: xcodegen/script/select_google_service_info_plist.sh<br>#     outputFiles:<br>#       - ${SRCROOT}/GoogleService-Info.plist<br>## Using Firebase Crashlytics</pre><p>To make the console logs more readable, you must upload the dSYM in the postBuildPhase. This is also commented out, so uncomment it as needed.</p><pre># If you use Firebase Crashlytics, you can use this script.<br># - name: &#39;[firebase_crashlytics] Crashlytics Upload Symbols&#39;<br>#   path: xcodegen/script/crashlytics_upload_symbols.sh<br>#   inputFiles:<br>#     - ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}<br>#     - ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}<br>#     - ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist<br>#     - $(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist<br>#     - $(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)</pre><h3>Conclusion</h3><p>XcodeGen can be challenging to catch up with initially, so I hope this helps! Special thanks to <a href="https://medium.com/u/da07c5298661">cokaholic🐰🍁☄️🪐</a>for all the guidance!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6084b695a7b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>