vm_service 包提供了一个 Dart 库,用于与 Dart VM 服务协议通信,使开发者能够检查和控制正在运行的 Dart 应用程序。它支持跨 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台的实时调试、性能分析和运行时内省。该包使用 WebSocket 连接与 VM 交换结构化数据,对于调试器、分析器和观察工具等工具至关重要。它主要被开发和分析工具使用,而非终端用户应用程序。
适合场景
调试 Dart 应用程序
性能分析
运行时检查
工具集成
实时应用监控
开发环境诊断
主要特点
基于 WebSocket 的通信
支持所有主要平台
与 Dart DevTools 的集成
实时数据流
结构化 JSON-RPC 协议
可扩展以支持自定义操作
适合对象
Dart 工具开发者
调试框架
性能分析工具
IDE 集成
开发环境构建工具
使用建议
需要运行启用了服务协议的虚拟机
不适用于生产应用程序
在网络环境中需要适当的安全部署
限于调试和分析工作流
依赖于可能更改的 SDK 内部结构
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
Dart
An approachable, portable, and productive language for high-quality apps on any platform
Dart is:
Approachable:
Develop with a strongly typed programming language that is consistent,
concise, and offers modern language features like null safety and patterns.
Portable:
Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend.
Compile to JavaScript or WebAssembly for the web.
Productive:
Make changes iteratively: use hot reload to see the result instantly in your running app.
Diagnose app issues using DevTools.
Dart's flexible compiler technology lets you run Dart code in different ways,
depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more),
Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an
AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time
compiler (dartdevc) and a production time compiler (dart2js).
Browse pub.dev for more packages and libraries contributed
by the community and the Dart team.
Our API reference documentation is published at api.dart.dev,
based on the stable release. (We also publish docs from our
beta and dev channels,
as well as from the primary development branch).