What is the difference between debug mode and profile mode?

Technology CommunityCategory: FlutterWhat is the difference between debug mode and profile mode?
VietMX Staff asked 3 years ago

Debug Mode:

  • It is used during development stage and when you want to use hot reload.
  • By default, flutter run compiles to debug mode.
  • 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.

Profile Mode:

  • Profile mode is used when you want to analyze performance.
  • The command flutter run --profile compiles to profile mode.
  • 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.