This release is a pre-release and may not be stable for production use.
Dart VM Service Client
A Python client library to communicate with a Dart VM Service gRPC server for controlling Flutter applications.
Installation
- Install dependencies using pip:
pip install -r requirements.txt
-
Ensure you have the Dart SDK installed on your system
- The client can automatically find Dart in your PATH
- Alternatively, you can specify the path to the Dart executable
-
If needed, generate the Python gRPC code:
python -m grpc_tools.protoc -I./protos --python_out=. --grpc_python_out=. ./protos/dart_vm_service.proto
This will create the following files:
dart_vm_service_pb2.pydart_vm_service_pb2_grpc.py
Usage
Basic Usage
from dart_vm_client import DartVmClient
# Create a client and start the Dart VM Service automatically
with DartVmClient() as client:
# Connect to a Flutter app
response = client.connect("ws://127.0.0.1:8181/ws")
print(f"Connection status: {response.success}, Message: {response.message}")
if response.success:
# Interact with the app
client.tap_widget_by_text("Login")
# Enable debug features
client.toggle_debug_paint(enable=True)
client.toggle_performance_overlay(enable=True)
# Service is automatically stopped when exiting the "with" block
Manual Service Management
from dart_vm_client import DartVmClient, DartVmServiceClient, DartVmServiceManager
# Start the service separately
service_manager = DartVmServiceManager(port=8080)
if service_manager.start():
# Create a client that connects to the running service
client = DartVmServiceClient("localhost:8080")
try:
# Use the client...
client.connect("ws://127.0.0.1:8181/ws")
finally:
# Clean up
client.close()
service_manager.stop()
Available Methods
The client provides numerous methods for interacting with Flutter apps, including:
Connection Management
connect(vm_service_uri): Connect to a Flutter app VM serviceclose(): Close the connection
Debug Visualization
toggle_debug_paint(enable=True): Toggle debug paintingtoggle_repaint_rainbow(enable=True): Toggle repaint rainbowtoggle_performance_overlay(enable=True): Toggle performance overlaytoggle_baseline_painting(enable=True): Toggle baseline paintingtoggle_debug_banner(enable=True): Toggle debug banner
Widget Interaction
tap_widget_by_key(key_value): Tap a widget by keytap_widget_by_text(text): Tap a widget by textenter_text(key_value, text): Enter text in a widget by keyscroll_into_view_by_key(key_value, alignment=0): Scroll a widget into view by key
Inspection
dump_widget_tree(): Get the widget treedump_layer_tree(): Get the layer treedump_render_tree(): Get the render treetoggle_inspector(enable=True): Toggle the inspector
And many more. See the dart_vm_service_client.py file for a complete list of available methods.
Example
See example_usage.py for a more detailed example of how to use the client.
Custom Server Address
If your gRPC server is running on a different host or port, specify it when creating the client:
client = DartVmServiceClient(server_address="192.168.1.100:8080")
Error Handling
Use try/except to handle gRPC errors:
import grpc
from dart_vm_service_client import DartVmServiceClient
client = DartVmServiceClient()
try:
response = client.connect("ws://127.0.0.1:8181/")
# Your code here
except grpc.RpcError as e:
print(f"RPC Error: {e.code()}, {e.details()}")
finally:
client.close()
Metadata
Release files for dart-vm-client 0.0.1.dev4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dart_vm_client-0.0.1.dev4.tar.gz | 1.7 MB | Without provenance | Details for dart_vm_client-0.0.1.dev4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dart_vm_client-0.0.1.dev4-py3-none-any.whl | Python 3 | none | any | Details for dart_vm_client-0.0.1.dev4-py3-none-any.whl |
Total release size: 3.5 MB
Release files / dart_vm_client-0.0.1.dev4.tar.gz
| Download URL | dart_vm_client-0.0.1.dev4.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4e185b8e1bc71f8473c41e54c996076bfa1a839b9d877ecc94c284b48b8a460
|
|
BLAKE2b-256 checksum How to use checksums |
effb6f5f5db9a3ed90203598761fa454e325fd5a7c113e4b161bca2fabbb38b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / dart_vm_client-0.0.1.dev4-py3-none-any.whl
| Download URL | dart_vm_client-0.0.1.dev4-py3-none-any.whl |
|---|---|
| Size | 1.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b0b96b003d7e1c74fc198cde11ba36fc687eeb3fed58c76f2501c9e678ea9e9
|
|
BLAKE2b-256 checksum How to use checksums |
5857d063be0513db49f622cd5d1ef2dd00f7c18d40beb03e70debb3b5d09420d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for dart-vm-client 0.0.1.dev4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.