10x Supercharge your Flutter Development Experience

Tired of switching flutter versions, running long build runner commands, cocoapods issues, incompatible ruby versions and fastlane? Worry not, we can fix it all.

Hi, I am a flutter developer and in this article I am going to unveil the secrete of 10x productivity. I are going to cover version management using mise, must have alias and scripts. Sorry if you are Windows user. It only works on Linux and Mac OS.

So let’s supercharge…

What is mise?

Dev tools, env vars, task runner. The front-end to your dev env.

mise-en-place

Let me describe you in simple term. You may have used our favorite fvm, the tool to manage flutter versions. But was it easy? Hell no. Everytime you want to run flutter command you have to append fvm in front of it like fvm flutter run and you also need to configure your IDE VS Code and Android Studio. This is really annoying. What if you don’t need to type fvm and configure IDE but still you can use multiple flutter versions like fvm? This is what exactly mise can do.

Warning! Common Sense Required: If you don’t know what you are doing don’t flow it blindly. I am not liable if it breaks your setup.

Before starting to use mise uninstall flutter, ruby, node, cocoapods that you have already installed. We are going to use mise to install them all.

Install mise

curl https://mise.run | sh

Hook mise into your shell (pick the right one for your shell):

# note this assumes mise is located at ~/.local/bin/mise
# which is what https://mise.run does by default
echo 'eval "$(~/.local/bin/mise activate bash --shims)"' >> ~/.bashrc
echo 'eval "$(~/.local/bin/mise activate zsh --shims)"' >> ~/.zshrc
echo '~/.local/bin/mise activate fish --shims | source' >> ~/.config/fish/config.fish

You can also install using the instructions in the official GitHub repository. Above instructions are copied from there. But don’t forget to use shims as it is necessary for your IDE to detect flutter and dart binary.

# install flutter plugin
mise plugin install flutter

# list available flutter versions
mise ls-remote flutter

# let's install latest flutter version
mise install flutter@latest

# set latest flutter version as global
mise global flutter@latest

# check flutter path
which flutter # it will give you flutter path from mise shims

# list flutter versions installed using mise
mise ls flutter

# check the flutter version
flutter --version

# install another flutter version
mise install flutter@3.19.4

# use flutter 3.19.4 as local version
mise use flutter@3.19.4

# check the flutter version again
flutter --version # will give 3.19.4

Is not this amazing that you don’t need to type fvm everytime? Bonus: if you use NodeJS too install it with mise install node@latest. If IDE does not detect flutter path then flutter pub clean, flutter pub get and then restart your IDE.

Now let’s install ruby. But why? It is preinstalled. Yes it’s preinstalled and it makes life harder. It always breaks fastlane and cocoapods. It requires sudo to install and update cocoapods.

Never, never use sudo if you don’t know its consequences.

A 10x developer

Let’s supercharge it too.

# install desired ruby version
mise install ruby@3.2.3

# make ruby 3.2.3 global
mise global ruby@3.2.3

# check ruby path
which ruby # it will give you ruby path from mise shims

# install cocoapods
gem install cocoapods # no need to sudo, I told you

What about fastlane? A 10x developer will recommend you to use bundler for fastlane. It will make sure that fastlane will behave as expected across all the devices and CI/CD server. So visit https://docs.fastlane.tools/getting-started/ios/setup/ and setup fastlane as described under bundler section.

After that you can use fastlane with bundle exec fastlane from the folder you just installed fastlane.

Must have Snippets for Flutter

Add these alias into your ~/.zshrc or ~/.bashrc based on what shell you use. Mac OS uses zsh so just copy paste this into ~/.zshrc and if you are Linux user you already know this.

# Flutter
alias fl="flutter"
alias flv='flutter --version'
alias flr="flutter run"
alias flan="flutter analyze"
alias fldoc="flutter doctor"
alias flb="flutter build"
alias flattach="flutter attach"
alias flget="flutter pub get"
alias flc="flutter clean"
alias flbr="dart run build_runner watch --delete-conflicting-outputs"
alias flbrb="dart run build_runner build --delete-conflicting-outputs"

Now instead of running dart run build_runner watch --delete-conflicting-outputs just run flbr and watch the magic.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.