flutter build size is more than expected
Solution 1
From the docs:
By default, flutter run
compiles to debug mode It means:
- Assertions are enabled.
- Observatory is enabled, allowing you to use the dart debugger.
- Service extensions are enabled.
- Compilation is optimized for fast development and run cycles (but not for execution speed, binary size, or deployment.)
You should use flutter run --release
for deploying the app, when you want maximum optimization and minimal footprint size. It means:
- Assertions are disabled.
- Debugging information is stripped out.
- Debugging is disabled.
- Compilation is optimized for fast startup, fast execution, and small package sizes.
- Service extensions are disabled.
Solution 2
From here
Debug
- Compilation is optimized for fast development and run cycles (but not for execution speed, binary size, or deployment.)
Release
- Compilation is optimized for fast startup, fast execution, and small package sizes.
In debug mode, the APK size will be higher compared to release mode. Because, in order to increase the development speed and run cycles, they do debug processes in the APK itself.
But in release mode, you'll get small package size as they will remove development packages from the APK.

virtouso
im a web and video game developer. im from iran. mostly interested in unity and unreal engine but as a career i work on asp too.
Updated on December 10, 2022Comments
-
virtouso 18 minutes
As i searched in internet, an empty flutter build should be about 7.5 megabytes.
I build it in debug mode using command prompt windows flutter run its about 26 megabytes. Is there any settings or something else to make the final output optimized and less size?