Skip to content

how to install Flutter correctly using asdf

At Twiage, we maintain a Flutter project called STAT, a complete rewrite of a native mobile app. To be honest, I was never a fan of Flutter or Dart. I always felt uncomfortable working with them.

Since 2020 I have experimented with both Flutter and React Native, and until recently React Native was my go-to for cross-platform mobile development. Flutter felt clunky in comparison, and I wrote it off.

What made me like React Native:

  • built-in TypeScript support
  • a huge and active JavaScript community
  • compatibility with almost every JS library
  • a simple and fast install
  • Expo makes things easier

I worked with React Native up to version 0.72.0.

My frustration came from two things:

  1. it competes directly with React Native.
  2. it uses Dart, a language that is not JavaScript and does not try to be.

I held a grudge against Dart for trying to replace JavaScript. Dart is not backward compatible with JS and shares little syntax. For a long time, I did not want to learn it.

Dart compilation guide

installing Flutter the right way (with asdf)

Section titled “installing Flutter the right way (with asdf)”

Installing Flutter can be frustrating, especially with JDK version issues and path configuration. That is where asdf helps: a version manager that saved me time.

Here is a step-by-step guide to set up Flutter with asdf.

Terminal window
asdf plugin add flutter
asdf install flutter latest

You will likely hit a JDK warning when running flutter doctor. Flutter expects a specific JDK version, usually JDK 17.

Terminal window
asdf plugin add java
asdf install java adoptopenjdk-17.0.0+12
asdf local java adoptopenjdk-17.0.0+12

Point Flutter to the correct JDK directory:

Terminal window
flutter config --jdk-dir $(asdf where java)
Terminal window
flutter create myapp
cd myapp
flutter run

Despite the rocky start with Flutter and Dart, I started to appreciate what they bring. With asdf, installing and managing Flutter and Java versions is much more manageable, especially in a multi-language setup.

If you are coming from React Native, the transition can be frustrating, but tools like asdf make Flutter more approachable.

Read the asdf docs for more. If you have questions about your mobile setup, reach out.

Connect with me on LinkedIn