### Cherry-Pick CL Description Example Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Example of a commit message for a cherry-pick CL in the Dart SDK, including issue details, fix description, risk assessment, and links. ```none [stable or beta] Cherry-pick DevTools into the SDK branch. Issue description: When attempting to use foo under certain conditions, users are unable to compile. What is the fix: foo is now evaluated at runtime. Why cherry-pick: Users of foo are no longer able to compile to bar. Risk: Low, this fix has landed on the main channel and is tested on the same infrastructure. Issue link(s): https://github.com/dart-lang/sdk/issues/12345678 Cherry-pick: https://github.com/flutter/devtools/compare/... Change-Id: Id75075a7e697559263742bc25972ef47532c39cb ``` -------------------------------- ### Initialize Chart Controller and Setup Traces Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/shared/charts/README.md Override the initState method to configure the chart controller. Use setFixedYRange for line charts or omit for scatter charts to enable auto-scaling. Then, call setupTraces to prepare the data series. ```dart @override void initState() { super.initState(); // If you're creating a line chart then fix the Y-range. For a scatter chart // don't create a fixed range, then the chart will autmatically compute the // min/max range and rescale the axis. controller.setFixedYRange(0.4, 2.4); // Line chart fixed. // Create the traces to hold each set of data points e.g., temperature // collected every hour as well as barametric pressure collected every hour. setupTraces(); } ``` -------------------------------- ### Verify ChromeDriver Installation Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/integration_test/README.md Check if chromedriver can be started successfully on the specified port. ```bash chromedriver --port=4444 ``` -------------------------------- ### DevTools Extension Configuration (`config.yaml`) Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/example/README.md Example `config.yaml` file required for embedding your extension in DevTools. Ensure all fields are configured correctly. ```yaml name: foo issueTracker: version: 0.0.1 materialIconCodePoint: '0xe0b1' ``` -------------------------------- ### Generate Scene Runners with build_runner Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/test/test_infra/scenes/README.md Run this command in your terminal to generate the necessary scene runners. Ensure you have the build_runner package installed. ```bash dart run build_runner build --delete-conflicting-outputs ``` -------------------------------- ### In-File Test Arguments Example Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/integration_test/README.md Configure test runner arguments directly within the test file using specially formatted comments. ```dart // Do not delete these arguments. They are parsed by test runner. // test-argument:appPath="test/test_infra/fixtures/memory_app" // test-argument:experimentsOn=true ``` -------------------------------- ### Validate DevTools Extension Setup Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Run the `validate` command from `package:devtools_extensions` to ensure your extension is properly set up for loading in DevTools. The `--package` argument should point to the root of the Dart package providing the extension. ```sh cd your_extension_web_app; flutter pub get; dart run devtools_extensions validate --package=../some_pkg ``` -------------------------------- ### Update DevTools and Dependencies Source: https://github.com/flutter/devtools/blob/master/BETA_TESTING.md Ensure your DevTools repository is up to date with the master branch and fetch the latest Flutter SDK. This command also performs a package get and upgrade for the main package. ```bash 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 ``` -------------------------------- ### Serve DevTools Web App with DevTools Server Source: https://github.com/flutter/devtools/blob/master/DEBUGGING.md Run this command to serve the DevTools web app in release mode, emulating the production environment with the DevTools server. ```bash dt serve ``` -------------------------------- ### Build Perfetto UI Locally Source: https://github.com/flutter/devtools/blob/master/third_party/packages/perfetto_ui_compiled/README.md Instructions for building the Perfetto UI locally to test changes within DevTools. This involves building the UI from a local Perfetto branch. ```bash tools/install-build-deps --ui ui/build ``` -------------------------------- ### Build and Copy Command for Extensions Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/example/README.md Command to populate the `extension/devtools/build` directory with pre-compiled extension output. ```sh flutter pub get && dart run devtools_extensions build_and_copy \ --source=. \ --dest=../foo/extension/devtools ``` -------------------------------- ### Initialize Dart Foo DevTools Extension Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/example/packages_with_extensions/dart_foo/packages/dart_foo_devtools_extension/web/index.html This code snippet is the main entry point for the Dart Foo DevTools extension. It listens for the window load event to download and initialize the Flutter engine. ```javascript dart_foo_devtools_extension // The value below is injected by flutter build, do not touch. const serviceWorkerVersion = null; window.addEventListener('load', function(ev) { // Download main.dart.js _flutter.loader.loadEntrypoint({ serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, }, onEntrypointLoaded: function(engineInitializer) { engineInitializer.initializeEngine().then(function(appRunner) { runAppner.runApp(); }); } }); }); ``` -------------------------------- ### Get Latest Commit Date for DevTools Source: https://github.com/flutter/devtools/blob/master/tool/README.md Use this command to retrieve the commit date of your current DevTools version. This date is crucial for finding the closest compatible Flutter candidate release. ```bash git show -s --format=%ci ``` -------------------------------- ### Configure .pubignore for Build Artifacts Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Add this entry to a `.pubignore` file in the `extension/devtools/` directory to ensure the `build` directory is included when publishing, even if it's git ignored. ```yaml !build ``` -------------------------------- ### Run Size Benchmarks Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/benchmark/README.md Execute the size benchmark test locally. This command measures the release build size of the DevTools web bundle. ```sh flutter test benchmark/web_bundle_size_test.dart ``` -------------------------------- ### Build and Copy Extension Assets Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Use the `build_and_copy` command from `package:devtools_extensions` to copy your extension's built web assets. This command helps in preparing your extension for integration into a real DevTools environment. ```sh cd your_extension_web_app; flutter pub get; dart run devtools_extensions build_and_copy --source=. --dest=../some_pkg/extension/devtools ``` -------------------------------- ### Generate Release Notes PR Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/release_notes/README.md Run this command to draft release notes on a local `flutter/website` branch. Replace the path with your local `flutter/website` repository location. ```bash dt release-notes -w /Users/me/absolute/path/to/flutter/website ``` -------------------------------- ### Directory Structure for Standalone Package Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/example/README.md Recommended structure when creating a DevTools extension as a standalone package. ```plaintext standalone_tool/ # your new pub package extension/ devtools/ build/ ... # pre-compiled build output of standalone_tool config.yaml lib/ # source code for your extension ``` -------------------------------- ### Launch DevTools Extension with Simulated Environment Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Configure your VS Code launch.json to enable the simulated DevTools environment for your extension. This allows for a faster development cycle by simulating the DevTools-to-extension connection. ```json { "configurations": [ { "name": "devtools_extension + simulated environment", "cwd": "relative/path/to/your/extension", "request": "launch", "type": "dart", "args": [ "--dart-define=use_simulated_environment=true" ] } ] } ``` -------------------------------- ### Load Dart Foo Entrypoint Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/example/packages_with_extensions/dart_foo/packages/dart_foo/extension/devtools/build/index.html This script loads the main Dart entrypoint for the DevTools extension. It configures the service worker and initializes the Flutter engine. ```javascript dart_foo_devtools_extension // The value below is injected by flutter build, do not touch. const serviceWorkerVersion = "2383047046"; window.addEventListener('load', function(ev) { // Download main.dart.js _flutter.loader.loadEntrypoint({ serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, }, onEntrypointLoaded: function(engineInitializer) { engineInitializer.initializeEngine().then(function(appRunner) { appRunner.runApp(); }); } }); }); ``` -------------------------------- ### Run Performance Benchmarks Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/benchmark/README.md Execute the performance benchmark tests locally. This command initiates the measurement of DevTools frame times. ```sh dart run benchmark/scripts/run_benchmarks.dart ``` -------------------------------- ### Run DevTools as Flutter Web App from Command Line Source: https://github.com/flutter/devtools/blob/master/DEBUGGING.md Use this command to run DevTools as a Flutter web app from the command line. Add the --dart-define flag to enable experiments. ```bash flutter run -d chrome ``` ```bash flutter run -d chrome --dart-define=enable_experiments=true ``` -------------------------------- ### Run DevTools Extension with Simulated Environment from CLI Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Launch your app from the command line with the `--dart-define=use_simulated_environment=true` flag to enable the simulated DevTools environment. This is an alternative to configuring launch.json. ```console flutter run -d chrome --dart-define=use_simulated_environment=true ``` -------------------------------- ### Run Benchmark with Baseline File Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/benchmark/README.md Run performance benchmarks and compare them against a baseline benchmark file. This uses the `--baseline` flag to specify the comparison file. ```sh dart run benchmark/scripts/run_benchmarks.dart --baseline=/Users/me/baseline_file.json ``` -------------------------------- ### Compare Two Benchmark Files Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/benchmark/README.md Compare two previously saved benchmark result files to calculate deltas. Requires two JSON files containing benchmark data. ```sh dart run benchmark/scripts/compare_benchmarks.dart /Users/me/baseline_file.json /Users/me/test_file.json ``` -------------------------------- ### Initialize Perfetto UI and Handle Errors Source: https://github.com/flutter/devtools/blob/master/third_party/packages/perfetto_ui_compiled/lib/dist/index.html This script initializes the Perfetto UI by loading the frontend bundle and sets up global error handlers for timeouts, unhandled rejections, and script loading failures. It also manages the visibility of error messages and displays technical details. ```javascript 'use strict'; (function () { const TIMEOUT_MS = 20000; let errTimerId = undefined; function errHandler(err) { // Note: we deliberately don't clearTimeout(), which means that this // handler is called also in the happy case when the UI loads. In that // case, though, the onCssLoaded() in frontend/index.ts will empty the // , so |div| below will be null and this function becomes a // no-op. const div = document.getElementById('app_load_failure'); if (!div) return; div.style.opacity ='1'; const errDom = document.getElementById('app_load_failure_err'); if (!errDom) return; errDom.innerText += `${err}\n`; const storageJson = JSON.stringify(window.localStorage); const dbg = document.getElementById('app_load_failure_dbg'); if (!dbg) return; dbg.innerText = `LocalStorage: ${storageJson}\n`; if (errTimerId !== undefined) clearTimeout(errTimerId); } // For the 'Click here to clear all caches'. window.clearAllCaches = () => { if (window.localStorage) window.localStorage.clear(); if (window.sessionStorage) window.sessionStorage.clear(); const promises = []; if (window.caches) { window.caches.keys().then( keys => keys.forEach(k => promises.push(window.caches.delete(k)))); } if (navigator.serviceWorker) { navigator.serviceWorker.getRegistrations().then(regs => { regs.forEach(reg => promises.push(reg.unregister())); }); } Promise.all(promises).then(() => window.location.reload()); } // If the frontend doesn't come up, make the error page above visible. errTimerId = setTimeout(() => errHandler('Timed out'), TIMEOUT_MS); window.onerror = errHandler; window.onunhandledrejection = errHandler; const versionStr = document.body.dataset['perfetto_version'] || '{}'; const versionMap = JSON.parse(versionStr); const channel = localStorage.getItem('perfettoUiChannel') || 'stable'; // The '.' below is a fallback for the case of opening a pinned version // (e.g., ui.perfetto.dev/v1.2.3./). In that case, the index.html has no // valid version map; we want to load the frontend from the same // sub-directory directory, hence ./frontend_bundle.js. const version = versionMap[channel] || versionMap['stable'] || '.'; const script = document.createElement('script'); script.async = true; script.src = version + '/frontend_bundle.js'; script.onerror = () => errHandler(`Failed to load ${script.src}`); document.head.append(script); })(); ``` -------------------------------- ### Create DevTools Extension App Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Command to create a new Flutter web app for your DevTools extension. ```bash flutter create --template app --platforms web some_pkg_devtools_extension ``` -------------------------------- ### Run DevTools unit, widget, and partial integration tests Source: https://github.com/flutter/devtools/blob/master/TESTING.md Executes all unit, widget, and partial integration tests within the packages/devtools_app directory. ```shell cd packages/devtools_app flutter test test/ ``` -------------------------------- ### Publish Script for DevTools Extension Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md A sample shell script to automate building the DevTools extension and publishing the package. It ensures the extension is built before publishing. ```sh pushd your_extension_web_app flutter pub get dart run devtools_extensions build_and_copy --source=. --dest=../your_pub_package/extension/devtools popd pushd your_pub_package flutter pub publish popd ``` -------------------------------- ### Run a Single Integration Test Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/integration_test/README.md Execute a specific integration test by providing the target test file path. ```bash dart run integration_test/run_tests.dart --target=integration_test/test/my_test.dart ``` -------------------------------- ### Manage VM service connections and extensions Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app_shared/README.md Initialize and manage `ServiceManager` to connect to the VM service, listen for connection updates, and interact with service extensions and isolates. ```dart import 'package:devtools_app_shared/service.dart'; import 'package:devtools_app_shared/service_extensions.dart' as extensions; import 'package:devtools_shared/service.dart'; void main() { final serviceManager = ServiceManager(); // Use the [connectedState] notifier to listen for connection updates. serviceManager.connectedState.addListener(() { if (serviceManager.connectedState.value.connected) { print('Manager connected to VM service'); } else { print('Manager not connected to VM service'); } }); // To get a [VmService] object from a vm service URI, consider importing // `package:devtools_shared/service.dart` from `package:devtools_shared`. final finishedCompleter = Completer(); final vmService = await connect( uri: Uri.parse(vmServiceUri), finishedCompleter: finishedCompleter, serviceFactory: VmService.defaultFactory, ); await serviceManager.vmServiceOpened( vmService, onClosed: finishedCompleter.future, ); // Get a service extension state. final ValueListenable performanceOverlayEnabled = serviceManager.manager.serviceExtensionManager.getServiceExtensionState( extensions.performanceOverlay.extension, ); // Set a service extension state. await serviceManager.manager.serviceExtensionManager.setServiceExtensionState( extensions.performanceOverlay.extension, enabled: true, value: true, ); // Access isolates. final myIsolate = serviceManager.isolateManager.mainIsolate.value; // Etc. } ``` -------------------------------- ### Compare dart2wasm Performance with Options Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/benchmark/README.md Run the dart2wasm performance comparison script with optional flags to specify the number of runs, save location, or baseline/test files. ```sh dart run benchmark/scripts/dart2wasm_performance_diff.dart --average-of=5 --save-to-file=/path/to/results.csv --baseline=/path/to/baseline.json --test=/path/to/test.json ``` -------------------------------- ### Run a Scene with Flutter Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/test/test_infra/scenes/README.md Execute a generated scene runner using the flutter run command. Specify the target file and device. ```bash flutter run -t test/test_infra/scenes/hello.stager_app.g.dart -d macos ``` -------------------------------- ### Directory Structure for Existing Dart Package Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/example/README.md Recommended structure when adding a DevTools extension to an existing Dart package. ```plaintext foo/ # formerly the repository root of your pub package packages/ foo/ # your pub package extension/ devtools/ build/ ... # pre-compiled build output of foo_devtools_extension config.yaml foo_devtools_extension/ # source code for your extension ``` -------------------------------- ### Launch DevTools on Mac (ARM) Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Launches the DevTools executable from a locally built Dart SDK on Macs with ARM-based processors (M chips). ```shell xcodebuild/ReleaseARM64/dart-sdk/bin/dart devtools ``` -------------------------------- ### Launch DevTools on Mac (Intel) Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Launches the DevTools executable from a locally built Dart SDK on Macs with x64-based processors (Intel chips). ```shell xcodebuild/ReleaseX64/dart-sdk/bin/dart devtools ``` -------------------------------- ### Save Benchmark Results to File Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/benchmark/README.md Run performance benchmarks and save the results to a specified JSON file. This is useful for later comparison. ```sh dart run benchmark/scripts/run_benchmarks.dart --save-to-file=/Users/me/baseline.json ``` ```sh dart run benchmark/scripts/run_benchmarks.dart --save-to-file=/Users/me/test.json ``` -------------------------------- ### Load Foo DevTools Extension Entrypoint Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo/extension/devtools/build/index.html This script configures the service worker and loads the main Dart entrypoint for the Foo DevTools extension. It's essential for initializing the Flutter application within DevTools. ```javascript const serviceWorkerVersion = "3728206982"; window.addEventListener('load', function(ev) { // Download main.dart.js _flutter.loader.loadEntrypoint({ serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, }, onEntrypointLoaded: function(engineInitializer) { engineInitializer.initializeEngine().then(function(appRunner) { appRunner.runApp(); }); } }); }); ``` -------------------------------- ### Run DevTools on Windows or Linux Source: https://github.com/flutter/devtools/blob/master/DEBUGGING.md To run DevTools on Flutter desktop for Windows or Linux, first generate the necessary platform files using 'flutter create .', then run DevTools using 'flutter run -d '. ```bash flutter run -d ``` -------------------------------- ### Create Standalone DevTools Extension Package Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Use this command to generate a new Flutter web app package for a standalone DevTools extension. This package will contain the source code for your extension. ```console flutter create --template app --platforms web my_new_tool ``` -------------------------------- ### Commit and Push Cherry-Pick Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Stage all changes, commit them with a descriptive message, and push the new branch to the upstream remote. ```shell git add .; git commit -m "Prepare cherry-pick release - DevTools 2.29.1"; git push upstream 2.29.1 ``` -------------------------------- ### Sync DevTools and Update Dependencies Source: https://github.com/flutter/devtools/blob/master/CONTRIBUTING.md Run this command to sync your local DevTools repository with the latest code, update dependencies, and perform code generation. The `--update-on-path` flag also updates your local Flutter SDK. ```sh dt sync --update-on-path ``` ```sh dt sync ``` -------------------------------- ### Update Perfetto Build Output Source: https://github.com/flutter/devtools/blob/master/third_party/packages/perfetto_ui_compiled/README.md Run this script to update the pre-compiled Perfetto UI assets in DevTools. Ensure DevTools-authored files are preserved. ```bash devtools/tools/update_perfetto.sh ``` -------------------------------- ### Run All Integration Tests Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/integration_test/README.md Execute all integration tests defined in the project using the Dart run command. ```bash dart run integration_test/run_tests.dart ``` -------------------------------- ### Adding Images to Release Notes Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/release_notes/README.md Reference images in markdown after the release note entry. Ensure images are added to the `release_notes/images` folder. ```markdown ![Accessible image description](images/my_feature.png "Image hover description") ``` -------------------------------- ### Configure Dart SDK path Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Sets the LOCAL_DART_SDK environment variable to point to your local Dart SDK checkout. Replace `` with the actual path. ```shell DART_SDK_REPO_DIR= export LOCAL_DART_SDK=$DART_SDK_REPO_DIR/sdk ``` -------------------------------- ### Build the Chart Widget Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/shared/charts/README.md In the build method, instantiate the Chart widget, passing the controller and a title. Wrap the chart in a Padding widget for layout adjustments. ```dart @override Widget build(BuildContext context) { final ballChart = Chart(controller, 'Balls Chart'); return Padding( padding: const EdgeInsets.all(0.0), child: ballChart, ); } ``` -------------------------------- ### Run DevTools Web App with Debugging Support Source: https://github.com/flutter/devtools/blob/master/DEBUGGING.md Execute this command to run the DevTools web app in debug mode with full debugging support and a connection to a live DevTools server for a quicker development cycle. ```bash dt run ``` -------------------------------- ### Update Version for Next Release Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/release_notes/README.md Automatically update the version for the next release and prepare the `NEXT_RELEASE_NOTES.md` file. ```bash dt update-version auto -t minor; dt update-version auto -t dev ``` -------------------------------- ### Run Performance Benchmark Test File Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/benchmark/README.md Run the specific performance benchmark test file for DevTools. This is an alternative method to initiate performance tests. ```sh flutter test benchmark/devtools_benchmarks_test.dart ``` -------------------------------- ### VSCode Launch Configuration for Scenes Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/test/test_infra/scenes/README.md Configure VSCode to launch a specific scene. This configuration allows you to set the program path, device, and working directory for debugging. ```json { "name": "my-scene", "cwd": "devtools_app", "request": "launch", "type": "dart", "program": "test/scenes/memory/default.stager_app.g.dart", "deviceId": "macos" } ``` -------------------------------- ### Activate DCM License Key Source: https://github.com/flutter/devtools/blob/master/CONTRIBUTING.md Use this command to activate the Dart Code Metrics (DCM) license key. Replace YOUR_KEY with your actual license key. ```bash dcm activate --license-key=YOUR_KEY ``` -------------------------------- ### Generate Platform-Specific Files for DevTools Source: https://github.com/flutter/devtools/blob/master/DEBUGGING.md If running DevTools on Flutter Desktop fails, you may need to generate platform-specific files. Run the flutter create command from the devtools/packages/devtools_app directory. ```bash flutter create . ``` -------------------------------- ### Checkout DevTools Tag Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Fetch and checkout a specific tag from the upstream DevTools repository to prepare for a cherry-pick release. ```shell git fetch upstream git checkout v2.29.0 ``` -------------------------------- ### Create Cherry-Pick Branch Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Create a new local branch in the DevTools repository for the cherry-pick release. ```shell git checkout -b 2.29.1 ``` -------------------------------- ### Configure VS Code for Local DevTools Development Source: https://github.com/flutter/devtools/blob/master/DEBUGGING.md Add this configuration to your VS Code settings JSON to instruct VS Code to run the `dt serve` command using your local DevTools source code. Ensure LOCAL_DART_SDK and FLUTTER_ROOT are set correctly. ```json "dart.customDevTools": { "path": "/absolute/path/to/devtools/repo", "env": { "LOCAL_DART_SDK": "/absolute/path/to/sdk", "FLUTTER_ROOT": "/absolute/path/to/devtools/tool/flutter-sdk" }, "args": [ // Arguments that will be passed along to the `dt serve` command. ], } ``` -------------------------------- ### Run DevTools for a Specific Platform Source: https://github.com/flutter/devtools/blob/master/BETA_TESTING.md Execute DevTools for a target platform (chrome, macos, or windows) using the Flutter SDK. Use the --release flag for optimized performance. Add '--dart-define=enable_experiments=true' to enable experimental features. ```bash ../../tool/flutter-sdk/bin/flutter run --release -d ``` -------------------------------- ### Validate DevTools Extension Configuration Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Run this command to validate your extension's `config.yaml` file against the required specifications. Ensure you are in the extension's web app directory. ```sh cd your_extension_web_app; flutter pub get; dart run devtools_extensions validate --package=path/to/pkg_providing_your_extension_assets ``` -------------------------------- ### Create a StatefulWidget for a Chart Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/shared/charts/README.md Define a StatefulWidget to host the chart. This includes initializing a ChartController which manages the chart's data and state. ```dart class MyChart extends StatefulWidget { MyChart({super.key}); final controller = ChartController(); @override State createState() => MyChartState(); } class MyChartState extends State { MyChartState(this.controller); ChartController get controller => widget.controller; } ``` -------------------------------- ### Launch DevTools on Non-Mac Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Launches the DevTools executable from a locally built Dart SDK on non-Mac systems. ```shell out/ReleaseX64/dart-sdk/bin/dart devtools ``` -------------------------------- ### Commit and Upload Dart SDK CL Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md Stage changes, commit them with a message indicating the cherry-pick, and upload the changes to Gerrit for review. ```shell git add . git commit -m "Cherry-pick DevTools 2.29.1" git cl upload -s ``` -------------------------------- ### Create a New Branch Source: https://github.com/flutter/devtools/blob/master/CONTRIBUTING.md Before implementing changes, create a new branch from your cloned DevTools repository. ```sh git checkout -b myBranch ``` -------------------------------- ### Commit Changes Source: https://github.com/flutter/devtools/blob/master/CONTRIBUTING.md Implement your changes and commit them to your branch with a descriptive message. If the improvement is user-facing, document it in the `release_notes`. ```sh git commit -m “description” ``` -------------------------------- ### Check DCM Version Source: https://github.com/flutter/devtools/blob/master/CONTRIBUTING.md Verify your local DCM version matches the version used on GitHub bots by running this command. ```sh dcm --version ``` -------------------------------- ### Create DevTools Tag for Cherry-Pick Release Source: https://github.com/flutter/devtools/blob/master/tool/RELEASE_INSTRUCTIONS.md After a cherry-pick CL has been approved and merged, create a tag for the cherry-pick release. This ensures a tag exists for potential future cherry-pick releases. Checkout the cherry-pick branch and use the `dt tag-version` command. ```sh git checkout upstream/2.29.1 dt tag-version ``` -------------------------------- ### Update DevTools Perfetto Build Source: https://github.com/flutter/devtools/blob/master/third_party/packages/perfetto_ui_compiled/README.md Update the DevTools Perfetto build with your local Perfetto UI build output. This command points to the local build directory. ```bash update_perfetto.sh -b /Users/me/path/to/perfetto/out/ui/ui/dist ``` -------------------------------- ### Import shared component libraries Source: https://github.com/flutter/devtools/blob/master/packages/devtools_app_shared/README.md Import the specific component libraries you need from the package. ```dart import 'package:devtools_app_shared/service.dart'; import 'package:devtools_app_shared/service_extensions.dart' as extensions; import 'package:devtools_app_shared/ui.dart'; import 'package:devtools_app_shared/utils.dart'; ``` -------------------------------- ### DevTools Extension Configuration (config.yaml) Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/README.md Metadata file required for DevTools to load your extension. Ensure exact field names are used. ```yaml name: some_pkg issueTracker: version: 0.0.1 materialIconCodePoint: '0xe0b1' requiresConnection: true # optional field - defaults to true ``` -------------------------------- ### DevTools Extension Config: Does Not Require Connection Source: https://github.com/flutter/devtools/blob/master/packages/devtools_extensions/extension_config_spec.md Configure this for extensions that do not require a connected app. Set `requiresConnection` to `false` to enable this behavior. ```yaml name: foo_package issueTracker: version: 0.0.1 materialIconCodePoint: '0xe0b1' requiresConnection: false ```