How to build a release mode without a key in flutter - Flutter debug mode is so slow

320

Short Answer:

There are 3 different build modes in flutter:

  1. Debug : This is the most common mode we always test the apps. If you are using Android Studio you can find its button on the top panel (a green play button).

    flutter run
    
  2. Release : This mode is for deploying the app on market places.

    Note: This mode needs a key generated for android release mode.

    flutter run --release
    
  3. Profile : This is the mode you are looking for. In profile mode, some debugging ability is maintained—enough to profile your app’s performance and also it has the performance as the release mode.

    flutter run --profile
    

Long Answer:

  1. Debug:

In debug mode, the app is set up for debugging on the physical device, emulator, or simulator.

Debug mode for mobile apps mean that:

Assertions are enabled. Service extensions are enabled. Compilation is optimized for fast development and run cycles (but not for execution speed, binary size, or deployment). Debugging is enabled, and tools supporting source level debugging (such as DevTools) can connect to the process.

Debug mode for a web app means that:

The build is not minified and tree shaking has not been performed. The app is compiled with the dartdevc compiler for easier debugging.

By default, flutter run compiles to debug mode. Your IDE supports this mode. Android Studio, for example, provides a Run > Debug… menu option, as well as a green bug icon overlayed with a small triangle on the project page.

  1. Release:

Use release mode for deploying the app, when you want maximum optimization and minimal footprint size. For mobile, release mode (which is not supported on the simulator or emulator), means that:

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.

Release mode for a web app means that:

The build is minified and tree shaking has been performed. The app is compiled with the dart2js compiler for best performance.

  1. Profile:

In profile mode, some debugging ability is maintained—enough to profile your app’s performance. Profile mode is disabled on the emulator and simulator, because their behavior is not representative of real performance. On mobile, profile mode is similar to release mode, with the following differences:

Some service extensions, such as the one that enables the performance overlay, are enabled. Tracing is enabled, and tools supporting source-level debugging (such as DevTools) can connect to the process.

Profile mode for a web app means that:

The build is not minified but tree shaking has been performed. The app is compiled with the dart2js compiler.

You can find the docs on flutter official website here: Flutter's build modes

Share:
320
Taba
Author by

Taba

Fluttering. Open to work. Contact me with e-mail: [email protected]

Updated on January 03, 2023

Comments

  • Taba
    Taba over 1 year

    Whenever I try to test my app with flutter run command it's so laggy and slow and I can't determine how is my app performance in a release mode. However for building the app in release mode for android we need to make a key for the app and it doesn't show most of the Log files and Prints.

    So the question is, Is there any way to run the app in release mode format but with debug features?