This is a dead simple and minimal dev workflow setup for flutter development.
Aight first up, let's see the memory footprint
These screenshots are taken from my Hyprland setup which is a very minimal Desktop Setup.
You can see that neovim is taking only 41mb of RAM while scrcpy is taking 181mb of RAM. These two apps replaces the VsCode and Android emulator which results in like 90% memory freeing.
With Hyprland, my complete setup when running the emulator and code editor is still under 4GB of RAM.
And with everything configured, this is how the setup looks;
Ingredients:
- A package manager - to install stuff easily
- Neovim - for code editing
- Android studio - for managing the android sdk
- Flutter sdk - duh.!
- Scrcpy - android screen mirroring tool
- Your android phone - for the emulation (assuming it is above android version 5)
Steps:
-
Setup package manager.
Linux:
you already have a package manager built in!macOS:
# skip the first command if you already have homebrew installed. /bin/bash -c "$(curl -fssl https://raw.githubusercontent.com/homebrew/install/head/install.sh)"
Windows:
- Follow this guide to setup chocolatey if you haven't: https://chocolatey.org/install
-
Install neovim (skip if deciding to use VsCode).
Install neovim and configure it work with flutter. if you aren't familier with vim motions, you can swap this step with vscode but it will increase the memory footprint when running everything. But it will still be better than running the emulator with VsCode.
Linux:
sudo pacman -s neovim # if you're on arch linux, for other distros, google it up
macOS:
brew install neovim
Windows:
choco install neovim
-
Install android studio.
Linux:
yay -s android-studio # if you're on arch linux, for other distros, google it up
macOS:
brew install --cask android-studio
Windows:
choco install androidstudio
-
Install flutter sdk.
Linux:
yay -s flutter-bin
macOS:
brew install --cask flutter
Windows:
choco install flutter
Flutter Setup (skip if you're VsCode and Install dart and flutter extensions instead):
Follow this guide to setup flutter tools with neovim (yeah it is lengthy but it's worth for the profit) - https://www.etiennetheodore.com/building-flutter-application-with-neovim/.-
Install scrcpy.
Linux:
yay -s scrcpy
macOS:
brew install scrcpy
Windows:
choco install scrcpy
-
Enable usb debugging in your android device.
a. Tap build number 7 times and enable developer. options
b. Go to it and enable usb debugging. -
Authorize your phone with adb.
a. Connect your phone via a usb cable to your pc/mac.
b. Typeadb devices
.
c. A prompt will come in your phone to authorize the device.
d. After that just plug out and re-plug your device to computer. -
Now create a new flutter project or open and existing one with neovim.
a.
cd
into your flutter project folder and typenvim .
.
b. Then press:
symbol and typeflutterRun
in neovim. this is a command provided by flutter-tools neovim plugin. you can learn all the commands it offers through their GitHub repo. -
Mirror the screen using scrcpy.
scrcpy --turn-screen-off
that's it!
You now have a very fast flutter emulator just beside your code editor. this can also setup to connect wirelessly. more on that in a future article.
Thank You for reading. Share if you think this is useful.
Top comments (0)