<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Takeshi Tsukamoto</title>
    <description>The latest articles on DEV Community by Takeshi Tsukamoto (@itome).</description>
    <link>https://dev.to/itome</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1920618%2F3aca3eeb-1ba2-434d-8239-2b44d5497a8b.png</url>
      <title>DEV Community: Takeshi Tsukamoto</title>
      <link>https://dev.to/itome</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/itome"/>
    <language>en</language>
    <item>
      <title>I Created a Rust-Based TUI Tool 'flx' for Flutter Developers</title>
      <dc:creator>Takeshi Tsukamoto</dc:creator>
      <pubDate>Tue, 13 Aug 2024 01:51:20 +0000</pubDate>
      <link>https://dev.to/itome/i-created-a-rust-based-tui-tool-flx-for-flutter-developers-2ppp</link>
      <guid>https://dev.to/itome/i-created-a-rust-based-tui-tool-flx-for-flutter-developers-2ppp</guid>
      <description>&lt;p&gt;Hello, I'm &lt;a href="https://x.com/itometeam" rel="noopener noreferrer"&gt;itome&lt;/a&gt;, working at a company that develops the &lt;a href="https://woodstock.club" rel="noopener noreferrer"&gt;woodstock.club&lt;/a&gt; app, where you can buy U.S. stocks starting from 200 yen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://woodstock.club" rel="noopener noreferrer"&gt;https://woodstock.club&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We've just launched our company's Zenn Publication, and we're planning to update it frequently.&lt;/p&gt;

&lt;p&gt;Recently, I had the opportunity to present at an event called FlutterNinjas, where I introduced a new Rust-based TUI tool for Flutter developers called flx. I’d like to share more about it here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/itome/flx" rel="noopener noreferrer"&gt;https://github.com/itome/flx&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is flx?
&lt;/h2&gt;

&lt;p&gt;flx is a TUI (Text User Interface) tool that lets you access functionalities similar to Flutter's DevTools directly from the terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2Ff5e9b45d2865-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2Ff5e9b45d2865-20240808.png" alt="flx screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TUI tools create a GUI-like display within the terminal. A well-known example of this is &lt;a href="https://github.com/jesseduffield/lazygit" rel="noopener noreferrer"&gt;lazygit&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I created it
&lt;/h2&gt;

&lt;p&gt;When developing with Flutter, running the &lt;code&gt;flutter run&lt;/code&gt; command in the terminal displays the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F54fa323a4c29-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F54fa323a4c29-20240808.png" alt="flutter run"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s convenient enough with features like hot reload and DevTools launching via shortcuts. However, I thought it would be even more useful if a TUI tool could provide not just logs but also network information and other insights—this idea sparked the creation of flx.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use it
&lt;/h2&gt;

&lt;p&gt;Simply replace &lt;code&gt;flutter run&lt;/code&gt; with the &lt;code&gt;flx&lt;/code&gt; command. Using &lt;code&gt;flx&lt;/code&gt; offers the same functionalities as &lt;code&gt;flutter run&lt;/code&gt; (like hot reload and log viewing) while also giving you access to additional features such as:&lt;/p&gt;

&lt;h3&gt;
  
  
  Monitoring network requests
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F74ba77e81d79-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F74ba77e81d79-20240808.png" alt="Network monitoring"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking the frame rate
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2Fb6c239bc40e6-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2Fb6c239bc40e6-20240808.png" alt="Frame rate check"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Inspecting the widget tree
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F74e80ec2da92-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F74e80ec2da92-20240808.png" alt="Widget tree inspection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Automatically loading .vscode/launch.json
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2Fbd38babedc65-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2Fbd38babedc65-20240808.png" alt="Auto load"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Other features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--fvm&lt;/code&gt; option for FVM users&lt;/li&gt;
&lt;li&gt;Running multiple apps simultaneously&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Technology stack
&lt;/h2&gt;

&lt;p&gt;To replicate the functionality of the &lt;code&gt;flutter run&lt;/code&gt; command, flx utilizes the &lt;a href="https://github.com/flutter/flutter/blob/master/packages/flutter_tools/doc/daemon.md" rel="noopener noreferrer"&gt;Flutter Daemon&lt;/a&gt; and &lt;a href="https://github.com/dart-lang/sdk/blob/main/runtime/vm/service/service.md" rel="noopener noreferrer"&gt;Dart VM Service&lt;/a&gt; to monitor networks and retrieve the widget tree.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F8b15d950c6d9-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F8b15d950c6d9-20240808.png" alt="Technology stack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Flutter Daemon
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;flutter daemon&lt;/code&gt; command triggers a CLI-specific Flutter API. It responds with JSON-RPC requests sent via standard input. You can use it to run apps, perform hot reloads/restarts, retrieve the list of connected devices, and get SDK versions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dart VM Service
&lt;/h3&gt;

&lt;p&gt;By connecting to a running Flutter app over WebSocket, you can retrieve various details about the app. This includes network and widget tree information, GC timing, frame graphs, and even setting breakpoints in the source code during execution. It provides nearly all the necessary features for developer tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rust
&lt;/h3&gt;

&lt;p&gt;I chose Rust for development. Since there’s a lot of asynchronous processing between the Flutter Daemon and Dart VM Service, I designed it using tokio with separate event loops. For state management, I used Redux.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;Here are some questions I received during the FlutterNinjas event:&lt;/p&gt;

&lt;h3&gt;
  
  
  Why use Rust for a Flutter tool?
&lt;/h3&gt;

&lt;p&gt;One reason is that there isn’t a standard library in Dart for creating TUIs, and another is my personal interest. Although Dart has a library for providing bindings for VM Service, Rust doesn’t, so I had to implement it from scratch based on the specifications. Considering the effort, it might have been faster to develop a TUI library in Dart.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not just use the official DevTools?
&lt;/h3&gt;

&lt;p&gt;Most of the features offered by flx can be covered by the official DevTools, so not everyone needs to use flx. Just like some people prefer using &lt;a href="https://www.gitkraken.com/" rel="noopener noreferrer"&gt;GitKraken&lt;/a&gt; while others use &lt;a href="https://github.com/jesseduffield/lazygit" rel="noopener noreferrer"&gt;lazygit&lt;/a&gt;, I hope terminal users find flx a more convenient option.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future plans
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F7f32ed146728-20240808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2F7f32ed146728-20240808.png" alt="Future plans"&gt;&lt;/a&gt;&lt;br&gt;
I’m currently working on implementing frame graph rendering similar to DevTools. Additionally, I’m considering using AI to analyze logs and automatically identify potential bugs.&lt;/p&gt;
&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;If you're a macOS user, you can install flx using the following command. Feel free to try it out, and I welcome any bug reports or suggestions for improvements!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install itome/tap/flx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're interested, please star the project on &lt;a href="https://github.com/itome/flx" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; to show your support!&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>rust</category>
      <category>tooling</category>
      <category>cli</category>
    </item>
  </channel>
</rss>
