Thanks to visit codestin.com
Credit goes to docs.flutter.dev

Skip to main content

Performance FAQ

Frequently asked questions about Flutter performance

This page collects some frequently asked questions about evaluating and debugging Flutter's performance.

  • How do I tell which widgets in my Flutter app are rebuilt in each frame?
    • Set debugProfileBuildsEnabled true in widgets/debug.dart.
    • Alternatively, change the performRebuild function in widgets/framework.dart to ignore debugProfileBuildsEnabled and always call Timeline.startSync(...)/finish.
    • If you use IntelliJ, a GUI view of this data is available. Select Track widget rebuilds, and your IDE displays which the widgets rebuild.
  • How to solve my app's poor animations caused by an expensive Dart async function call that is blocking the UI thread?
  • How can I take a screenshot of an app that is running and export it as a SKP file?
    • Run flutter screenshot --type=skia --observatory-uri=...
    • Note a known issue viewing screenshots:
    • To analyze and visualize the SKP file, check out the Skia WASM debugger.
  • How do I retrieve the shader persistent cache from a device?

    • On Android, you can do the following:
      adb shell
      run-as <com.your_app_package_name>
      cp <your_folder> <some_public_folder, e.g., /sdcard> -r
      adb pull <some_public_folder/your_folder>
      
  • How do I perform a trace in Fuchsia?