[engine] Enable new modular VM service (dart_runtime_service_vm) by default
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
## Overview
This issue tracks enabling the new modular Dart VM service implementation (`pkg/dart_runtime_service_vm`) by default in the Flutter engine and `flutter_tools`, replacing the legacy `dart:vmservice_io` implementation.
- Tracking PR: https://github.com/flutter/flutter/pull/190100
- Dart SDK Meta Issue: https://github.com/dart-lang/sdk/issues/64161
## Why This Work Is Needed
1. **Modernized Architecture**: The legacy VM service implementation is bundled inside the Dart SDK runtime (`runtime/bin/vmservice/`). Moving to `pkg/dart_runtime_service_vm` brings the VM service codebase into a standalone, maintainable Dart package that leverages standard Dart package tooling and dependencies.
2. **Simplified Embedder Startup**: The legacy service isolate relied on custom embedder hooks in `dart_service_isolate.cc` that dynamically looked up and swapped the root library (`Dart_LookupLibrary("dart:vmservice_io")` / `Dart_SetRootLibrary`). The new implementation boots the service entrypoint directly from a Kernel snapshot (`vmservice_snapshot.dill`) in debug mode and an AOT shared library (`libvmservice_snapshot.{so,dylib,dll}`) in profile mode.
3. **Standardized Packaging Across Platforms**: Unifies how VM service artifacts are produced, packaged, and loaded across all supported platforms (Android, iOS, macOS, Windows, Linux, and Fuchsia).
## Summary of Changes
- **C++ Embedder**: Updated `DartIsolate::DartCreateAndStartServiceIsolate` and `DartServiceIsolate::Startup` to boot the root library directly without `dart:vmservice_io` lookups.
- **Engine Build Rules & Snapshots**:
- Android: Packages `vmservice_snapshot.dill` in debug APK assets (extracted via `FlutterLoader.java`) and `libvmservice_snapshot.so` in profile mode.
- iOS & macOS: Bundles `vmservice_snapshot.dill` in debug assets and packages `libvmservice_snapshot.dylib` in macOS profile framework with nested codesigning.
- Windows & Linux: Bundles `vmservice_snapshot.dill` in debug mode and packages `libvmservice_snapshot.dll` / `libvmservice_snapshot.so` in profile mode.
- Fuchsia: Adds frontend server target for `vmservice_snapshot_dill` and includes it in package assets.
- **flutter_tools**: Updated build targets (`DebugIosApplicationBundle`, `DebugMacOSBundleFlutterAssets`, `UnpackLinux`, `UnpackWindows`) and device launch runners to pass `--vmservice-kernel-path` in debug mode and `--aot-vmservice-shared-library-name` in profile mode.
Contributor guide
Assessment
This issue has not been assessed yet.