Skip to content Skip to sidebar Skip to footer

Flutter Build Size Is More Than Expected

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

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.

Post a Comment for "Flutter Build Size Is More Than Expected"