<?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>Forem: Naomi Watanabe</title>
    <description>The latest articles on Forem by Naomi Watanabe (@napoleonna).</description>
    <link>https://forem.com/napoleonna</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%2F43516%2Feb875b0f-61fe-4377-9d98-0c80f4b608e5.jpg</url>
      <title>Forem: Naomi Watanabe</title>
      <link>https://forem.com/napoleonna</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/napoleonna"/>
    <language>en</language>
    <item>
      <title>How to use mise with FVM?</title>
      <dc:creator>Naomi Watanabe</dc:creator>
      <pubDate>Sat, 20 Jul 2024 01:25:43 +0000</pubDate>
      <link>https://forem.com/napoleonna/how-to-use-mise-with-fvm-2p1n</link>
      <guid>https://forem.com/napoleonna/how-to-use-mise-with-fvm-2p1n</guid>
      <description>&lt;p&gt;In Flutter, FVM is the primary Flutter version management tool. But what should we do when the monorepo or any other language project is involved? Should we use proper tools respectively?&lt;/p&gt;

&lt;p&gt;I recommend using mise in that case.&lt;/p&gt;

&lt;p&gt;Here, I focus on introducing how to use mise in FVM project. If you can start the Flutter project with mise, you do not need FVM. You can run the &lt;code&gt;mise use&lt;/code&gt; command or add the mise config file and run &lt;code&gt;mise i&lt;/code&gt; as well.&lt;/p&gt;

&lt;p&gt;Before we get to the main points, describe this tool briefly.&lt;/p&gt;

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

&lt;p&gt;According to &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fmise.jdx.dev%2Fabout.html" rel="noopener noreferrer"&gt;the official document&lt;/a&gt;, mise, formerly called rtx, is a development environment setup tool, and one of its functionality is this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mise installs and manages dev tools/runtimes like node, python, or terraform both simplifying installing these tools and allowing you to specify which version of these tools to use in different projects. mise supports hundreds of dev tools.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In short, mise is suitable for people who use various languages and projects with multiple components like front-end, back-end, or something.&lt;/p&gt;

&lt;p&gt;If you would like more information, check out the official site!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mise.jdx.dev/" class="ltag_cta ltag_cta--branded" rel="noopener noreferrer"&gt;mise.jdx.dev&lt;/a&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's get started!
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Uninstall FVM
&lt;/h3&gt;

&lt;p&gt;Unfortunately, we can not use mise and FVM together. To start using mise, we need to remove FVM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fvm destroy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;or if you installed using pub:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dart pub global deactivate fvm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://fvm.app/documentation/getting-started/faq#how-to-uninstall-fvm" class="ltag_cta ltag_cta--branded" rel="noopener noreferrer"&gt;FAQ – FVM&lt;/a&gt;
&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Uninstall Flutter
&lt;/h3&gt;

&lt;p&gt;We will install Flutter using mise and use it in each Flutter project. If you already have the Flutter SDKs installed, remove them to avoid conflict.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm -rf path/to/flutter
rm -rf  ~/.flutter*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Make sure to remove PATH as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.flutter.dev/get-started/uninstall" class="ltag_cta ltag_cta--branded" rel="noopener noreferrer"&gt;Uninstall Flutter | Flutter&lt;/a&gt;
&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Install mise and Flutter plugin
&lt;/h3&gt;

&lt;p&gt;Mise provides many ways to install, depending on your environment. Please follow the installation steps that suit you. Use Homebrew here:&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 mise
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://mise.jdx.dev/getting-started.html#getting-started" class="ltag_cta ltag_cta--branded" rel="noopener noreferrer"&gt;Getting Started | mise-en-place&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Then, install the Flutter plugin made by nyuyuyu. Be sure to install a plugin that supports FVM; the one in the mise plugin repositories does not.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mise plugin install flutter https://github.com/nyuyuyu/asdf-flutter.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/nyuyuyu" rel="noopener noreferrer"&gt;
        nyuyuyu
      &lt;/a&gt; / &lt;a href="https://github.com/nyuyuyu/asdf-flutter" rel="noopener noreferrer"&gt;
        asdf-flutter
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Flutter plugin for the asdf version manager 
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;asdf-flutter &lt;a href="https://github.com/nyuyuyu/asdf-flutter/actions/workflows/build.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/nyuyuyu/asdf-flutter/actions/workflows/build.yml/badge.svg" alt="Build"&gt;&lt;/a&gt; &lt;a href="https://github.com/nyuyuyu/asdf-flutter/actions/workflows/lint.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/nyuyuyu/asdf-flutter/actions/workflows/lint.yml/badge.svg" alt="Lint"&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="https://flutter.dev/" rel="nofollow noopener noreferrer"&gt;Flutter&lt;/a&gt; plugin for the &lt;a href="https://asdf-vm.com" rel="nofollow noopener noreferrer"&gt;asdf version manager&lt;/a&gt;.&lt;/p&gt;


&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Contents&lt;/h1&gt;
&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nyuyuyu/asdf-flutter#dependencies" rel="noopener noreferrer"&gt;Dependencies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nyuyuyu/asdf-flutter#install" rel="noopener noreferrer"&gt;Install&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nyuyuyu/asdf-flutter#support-fvm" rel="noopener noreferrer"&gt;Support fvm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nyuyuyu/asdf-flutter#contributing" rel="noopener noreferrer"&gt;Contributing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nyuyuyu/asdf-flutter#troubleshooting" rel="noopener noreferrer"&gt;Troubleshooting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nyuyuyu/asdf-flutter#license" rel="noopener noreferrer"&gt;License&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Dependencies&lt;/h1&gt;
&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;curl&lt;/code&gt;, &lt;code&gt;tar&lt;/code&gt;: generic POSIX utilities.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;jq&lt;/code&gt;: recommended.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;xz&lt;/code&gt;: only required for Linux.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Install&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;Plugin:&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;asdf plugin add flutter https://github.com/nyuyuyu/asdf-flutter.git&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;flutter:&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; Show all installable versions&lt;/span&gt;
asdf list-all flutter

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; Install specific version&lt;/span&gt;
asdf install flutter latest

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; Set a version globally (on your ~/.tool-versions file)&lt;/span&gt;
asdf global flutter latest

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; Now flutter commands are available&lt;/span&gt;
flutter --help&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Check &lt;a href="https://github.com/asdf-vm/asdf" rel="noopener noreferrer"&gt;asdf&lt;/a&gt; readme for more instructions on how to
install &amp;amp; manage versions.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Support fvm&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;If you have set &lt;code&gt;legacy_version_file = yes&lt;/code&gt; in &lt;code&gt;$HOME/.asdfrc&lt;/code&gt;, you can read the Flutter version from &lt;code&gt;.fvmrc&lt;/code&gt; or &lt;code&gt;.fvm/fvm_config.json&lt;/code&gt;, the &lt;a href="https://fvm.app/" rel="nofollow noopener noreferrer"&gt;fvm&lt;/a&gt; configuration file.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Troubleshooting&lt;/h1&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;VS Code&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/877327/158042623-290554da-0b9d-4fe0-b91b-c85b9c48e2d1.png"&gt;&lt;img width="668" alt="image" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F877327%2F158042623-290554da-0b9d-4fe0-b91b-c85b9c48e2d1.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To fix the "Could not find a Flutter SDK" error, you can set the &lt;code&gt;FLUTTER_ROOT&lt;/code&gt; environment variable in your &lt;code&gt;.bashrc&lt;/code&gt; or &lt;code&gt;.zshrc&lt;/code&gt; file:&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;export&lt;/span&gt; FLUTTER_ROOT=&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/nyuyuyu/asdf-flutter" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Bonus (for VSCode users): Add SDK paths in settings.json:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"dart.flutterSdkPaths": [
  "~/.local/share/mise/installs/flutter"
],
"dart.sdkPaths": [
  "~/.local/share/mise/installs/flutter"
],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it!&lt;/p&gt;

&lt;p&gt;Now, we can use mise with FVM, specifically the FVM config file. Simply running the command &lt;code&gt;mise i&lt;/code&gt; works perfectly.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>fvm</category>
      <category>mise</category>
    </item>
  </channel>
</rss>
