Make
Use Make to run many Flutter commands with one short command
When a Flutter project gets bigger, we need to run many terminal commands every day.
I use Make to group many commands into one short command. This saves time and also saves memory when working.
What is Make?
Make is a tool that runs tasks from a file named Makefile.
Official links:
Install Make
On macOS:
brew install makeAdd Make to a Flutter Project
Step 1: Create Makefile in project root
FVM := fvm
FVM_CACHE_PATH := $(CURDIR)/.fvm_cache
FVM_ENV := FVM_CACHE_PATH=$(FVM_CACHE_PATH) FLUTTER_SUPPRESS_ANALYTICS=true DART_SUPPRESS_ANALYTICS=true
.PHONY: init
init:
@echo "Using FVM cache at $(FVM_CACHE_PATH)"
$(FVM_ENV) $(FVM) install 3.27.4
$(FVM_ENV) $(FVM) use 3.27.4 --force
$(FVM_ENV) $(FVM) flutter pub getStep 2: Run
Without Make, most people run it manually like this:
With make init, we keep one short command and a fixed order.
This gives three big benefits:
Less confusion when running setup.
Easier to remember than many long commands.
Easier to teach new teammates because everyone runs the same command.
Real Examples from My Makefile
Below are examples I am using now. The important point: many lines become one short command.
Example 1: Full setup for new teammate
Manual way:
The Make target:
Make way:
Result: from 7 lines to 1 line, with fixed order and less confusion.
Example 2: Get dependencies for many packages
Manual way (long and easy to miss one package):
The Make target:
Make way:
Result: from many repeated lines to 1 line, easier to remember and teach.
Example 3: Push flow
Manual way:
The Make target groups analyze, commit, upstream check, and push flow.
Make way:
Result: from many steps to 1 short target.
Why Make Is Efficient
Less typing every day.
Less chance to forget steps.
Easier for team members to run the same workflow.
Easier to maintain command flow in one file.
Conclusion
Make helps me reduce repeated terminal work in Flutter projects. It also reduces memory load: from remembering many long commands to remembering a few short targets.
Important: With AI, you can freely create your own Make targets to fit your workflow.
Last updated