This page describes the fastest way to build DevTools with the goal to use it. Do not mix this setup with development environment. If you want to make code changes, follow contributing guidance.
You may want to build DevTools locally to:
Try experimental features
Run DevTools on Flutter Desktop instead of Flutter Web. This will eliminate issues like the browser memory limit, for example, to be able to analyze heap snapshots of large applications.
These steps are tested for Mac and may require adjustments for other platforms. Contributions to make these instructions more platform-agnostic are welcome.
Configure Dart & Flutter on your local machine.
After doing so, typing which flutter and which dart (or where.exe flutter and where.exe dart for Windows) into your terminal should print the path to your Flutter and Dart executables.
Ensure you have a clone of the DevTools repository on your machine. This can be a clone of flutter/devtools or a clone of a DevTools fork from your own Github account. You may want to fork Devtools to your own Github account if you plan to contribute to the project.
In your terminal, navigate to a directory where you want to clone DevTools: cd some/directory. This folder must not already contain a folder named ‘devtools’.
If you do not already have an SSH key set up for your machine, you may need to generate a new SSH key to connect to Github.
To clone flutter/devtools:
git clone git@github.com:flutter/devtools.git
To clone your fork of flutter/devtools:
git clone git@github.com:<your_github_account>/devtools.git
Ensure that you have access to the dt executable by:
flutter pub get on the devtools/tool directorydevtools/tool/bin folder to your PATH environment variable:add the following to your ~/.zshrc file (or ~/.bashrc, ~/.bash_profile if you use Bash), replacing <DEVTOOLS_DIR> with the absolute path to your DevTools repo:
export PATH=$PATH:<DEVTOOLS_DIR>/tool/bin
Path variable and click Edit<DEVTOOLS_DIR>/tool/bin, replacing <DEVTOOLS_DIR> with the absolute path to your DevTools repo.Explore the commands and helpers that the dt provides by running dt -h.
To ensure your DevTools repository is up to date and ready to build, run the following from the devtools directory (this will delete any local changes you have made to your DevTools clone):
git checkout master git reset --hard origin/master # (use upstream/master instead if you cloned a fork of DevTools) dt update-flutter-sdk dt pub-get --only-main --upgrade
From the main devtools/packages/devtools_app directory, run the following, where <platform> is one of chrome, macos, or windows depending on which platform you are targeting:
../../tool/flutter-sdk/bin/flutter run --release -d <platform>
--dart-define=enable_experiments=true to enable experimental features.Run the application that you want to debug or profile with DevTools.
Paste the VM Service URL of your application into the DevTools connect dialog. See this example.