How to Install Flutter
I'm going to describe it step by step as I tested in on my local machine (currently using M1 pro machine)
Step 1: Install Brew
Use the following command:
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
)"
Step 2: Install Java 8
https://stackoverflow.com/questions/24342886/how-to-install-java-8-on-mac
In short, use this command:
brew tap adoptopenjdk/openjdk && brew install --cask adoptopenjdk8
Step 3: Install fvm using brew
https://fvm.app/docs/getting_started/installation/
Use following command:
brew tap leoafarias/fvm && brew install fvm
Step 4: Install flutter using fvm
https://fvm.app/docs/guides/basic_commands/
Use following command:
fvm install <version>
Step 5: Try run flutter doctor to see what is missing
Use following command:
fvm flutter doctor
Step 6: If running flutter doctor for first time, then we need to set the fvm global version
Use following command:
fvm global 3.1.0
Step 7: Re-run the flutter doctor command in Step 5
Step 8: Download android studio
Step 9:
Download the emulator and other tools necessary inside Android Studio When finished it will show text like ‘Android SDK is up to date.’
Step 10:
Install the Android toolchain, and Xcode(?) Install plugins for flutter & dart in android studio
Step 11: How to fix ‘Unable to find bundled Java version’ on MAC OSX https://github.com/flutter/flutter/issues/118502
step 12: install cocoa pods
sudo gem install cocoapods
Additional Steps:
set JAVA_HOME in ~/.zshrc if you haven't already done it
export FLUTTER=fvm flutter in zshrc file if you haven't done it
set PATH and ANDROID_HOME
export PATH="/Users/USERNAME/Library/Android/sdk/platform-tools":$PATH export ANDROID_HOME="/Users/USERNAME/Library/Android/sdk"
Troubleshooting
Following things might be missing or need to be checked
android sdk location cannot be found on filesystem root, the default location would be at:
/Users/<username>/Library/Android/sdk
Android SDK Command-line Tools, how to fix android license error (command line tools)
https://stackoverflow.com/questions/61993738/flutter-doctor-android-licenses-gives-a-java-error
https://github.com/flutter/flutter/issues/120388
Good luck!
Subscribe to my newsletter
Read articles from GG directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
GG
GG
Clean Coder