Short Answer:
There are 3 different build modes in flutter:
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
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
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:
- 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.
- 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.
- 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