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'.To clone flutter/devtools:
- Clone the DevTools repo:
git clone [email protected]:flutter/devtools.git
- If you haven't already, you may need to generate a new SSH key to connect to Github with SSH.
To clone your fork of flutter/devtools:
- Fork the DevTools repo to your own Github account.
- Clone your fork of the DevTools repo:
git clone [email protected]:your_github_account/devtools.git
- If you haven't already, you may need to generate a new SSH key to connect to Github with SSH.
- Make sure to configure Git to keep your fork in sync with the upstream DevTools repo.
- Clone the DevTools repo:
-
Ensure that you have access to the
dt
executable by:- Running
flutter pub get
on thedevtools/tool
directory - Adding the
devtools/tool/bin
folder to yourPATH
environment variable:- MacOS Users
-
add the following to your
~/.zshrc
file (or~/.bashrc
,~/.bash_profile
if you use Bash), replacing<DEVTOOLS_DIR>
with the local path to your DevTools repo:export PATH=$PATH:<DEVTOOLS_DIR>/tool/bin
-
- Windows Users
- Open "Edit environment variables for your account" from Control Panel
- Locate the
Path
variable and click Edit - Click the New button and paste in
<DEVTOOLS_DIR>/tool/bin
, replacing<DEVTOOLS_DIR>
with the local path to your DevTools repo.
- MacOS Users
Explore the commands and helpers that the
dt
provides by runningdt -h
. - Running
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
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 ofchrome
,macos
, orwindows
depending on which platform you are targeting:../../tool/flutter-sdk/bin/flutter run --release -d <platform>
- Add
--dart-define=enable_experiments=true
to enable experimental features.
- Add
-
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.