My steps for setting up flutter on a Mac/Linux environment. The commands here use the Arch Linux yay package manager but can be adapted to any environment.
First, install the the flutter version manager fvm.
$ wget <https://github.com/leoafarias/fvm/releases/download/2.4.1/fvm-2.4.1-linux-x64.tar.gz>
$ tar -zxf fvm-2.4.1-linux-x64.tar.gz
$ mv fvm ~/.fvm
Add export=~/.fvm:PATH to your bashrc.
Install from .deb package from https://www.oracle.com/java/technologies/downloads/
On Arch Linux, use archlinux-java
$ sudo pacman -S dart
Then use dart to activate pub fvm
$ dart pub global activate fvm
On Arch Linux, install using yay
$ yay -S android-studio
The next step is can be done separately or through android studio. It is easier through android studio.
Download commandline-tools from android studio website.
$ unzip cmdline-tools.zip
$ cd cmdline-tools
$ cp -r * ~/Android/cmdline-tools/latest/
Add to bashrc and create respective folders.