-
Notifications
You must be signed in to change notification settings - Fork 1
Engine specific Service Protocol extensions
The Flutter engine adds several extensions to the Dart VM Service Protocol. The Flutter Engine specific extensions are documented here. Applications may also choose to register their own extensions.
Tooling requests this very early in the application lifecycle to ask for the details of the root isolate.
No arguments.
Response:
{
"type": "FlutterViewList",
"views": [
{
"type": "FlutterView",
"id": "_flutterView/0x1066096d8",
"isolate": {
"type": "@Isolate",
"fixedId": true,
"id": "isolates/453229818",
"name": "main.dart$main-453229818",
"number": 453229818
}
}
]
}
The IDE has requested (or the user pressed ‘R’ from the ‘flutter run’ interactive console) a cold reload. For example, this happens when the user presses the green play button.
Used to "cold reload" a running application where the shell (along with the platform view and its rasterizer bindings) remains the same but the root isolate is torn down and restarted with the new configuration. Only used in the development workflow.
The previous root isolate is killed and its identifier invalidated after this call. Callers can query the new isolate identifier using the _flutter.listViews
method.
Four arguments:
viewId = _flutterView/0x14ba08c68
mainScript = /path/to/application/lib/main.dart
packagesFile = /path/to/application/.packages
assetDirectory = /path/to/application/build/flutter_assets
Response:
{
"type": "Success",
"view": {
"type": "FlutterView",
"id": "_flutterView/0x104e0ab58",
"isolate": {
"type": "@Isolate",
"fixedId": true,
"id": "isolates/1056589762",
"name": "main.dart$main-1056589762",
"number": 1056589762
}
}
}
The object in the view key is constructed in the same way as the views in the List Views method.
Does nothing but waits for all pending tasks on the UI thread to be completed before returning success to the service protocol caller.
No arguments.
Response:
{"type": "Success"}
Get the screenshot as PNG of a random Flutter view on the device. The screenshot data will be base64 encoded in the response body.
No arguments.
Response:
{
"type": "Screenshot",
"screenshot": "<base64_data>"
}
Get the Skia SKP of a random Flutter view on the device. The SKP data will be base64 encoded in the response body.
No arguments.
Response:
{
"type": "ScreenshotSkp",
"skp": "<base64_data>"
}
In case of a hot-reload, the service protocol handles source code updates. However, there may be changes to assets. The DevFS updates assets in an separate directory that needs to be used by the engine.
Two arguments:
viewId = _flutterView/0x15bf057f8
assetDirectory = /path/to/flutter_assets
Response:
{
"type": "Success",
"view": {
"type": "FlutterView",
"id": "_flutterView/0x104e0ab58",
"isolate": {
"type": "@Isolate",
"fixedId": true,
"id": "isolates/1056589762",
"name": "main.dart$main-1056589762",
"number": 1056589762
}
}
}
The object in the view key is constructed in the same way as the views in the List Views method.
Get the display refresh rate of the actual device that runs the Flutter view. For example, most devices would return an fps of 60, while iPad Pro would return an fps of 120.
One argument:
viewId = _flutterView/0x15bf057f8
Response:
{
"type": "DisplayRefreshRate",
"fps": 60.0
}
Get Skia SkSL shader artifacts from an actual device that runs the Flutter view. Such artifacts can be used to warm up shader compilations and avoid jank. One has to first tell Flutter to prepare SkSL shaders by flutter run --cache-sksl
or flutter drive --cache-sksl
, and trigger some shader compilations by going through some animations/transitions. Otherwise, this service protocol extension may return an empty set of SkSLs.
The key of the returned SkSLs
map will be Base32 encoded. It should be used directly as the filename of the shader artifact. The value in that map is the Base64 encoded SkSL shader. Once decoded, it should be the content of the shader artifact file.
One argument:
viewId = _flutterView/0x15bf057f8
Response:
{
"type": "GetSkSLs",
"SkSLs": {
"CAZAAAACAAAAAAAAAAABGAABAAOAAFAADQAAGAAQABSQAAAAAAAAAAAAAABAAAAAEAAGGAA": "eQ=="
}
}
Estimate the memory usage of both picture and layer raster cache. For each picture or layer cached, there is a rasterized SkImage
of that picture or layer to speed up future draws. Only SkImage
's memory usage is counted as other objects in the cache system are often much smaller compared to SkImage
. Function SkImageInfo::computeMinByteSize
is used to estimate the SkImage
memory usage.
One argument
viewId = _flutterView/0x15bf057f8
Response:
{
"type": "EstimateRasterCacheMemory",
"layerBytes": 40000,
"pictureBytes": 400
}
- Home of the Wiki
- Roadmap
- API Reference (stable)
- API Reference (master)
- Glossary
- Contributor Guide
- Chat on Discord
- Code of Conduct
- Issue triage reports
- Our Values
- Tree hygiene
- Issue hygiene and Triage
- Style guide for Flutter repo
- Project teams
- Contributor access
- What should I work on?
- Running and writing tests
- Release process
- Rolling Dart
- Manual Engine Roll with Breaking Commits
- Updating Material Design Fonts & Icons
- Postmortems
- Setting up the Framework development environment
- The Framework architecture
- The flutter tool
- API Docs code block generation
- Running examples
- Using the Dart analyzer
- The flutter run variants
- Test coverage for package:flutter
- Writing a golden-file test for package:flutter
- Setting up the Engine development environment
- Compiling the engine
- Debugging the engine
- Using Sanitizers with the Flutter Engine
- Testing the engine
- The Engine architecture
- Flutter's modes
- Engine disk footprint
- Comparing AOT Snapshot Sizes
- Custom Flutter engine embedders
- Custom Flutter Engine Embedding in AOT Mode
- Flutter engine operation in AOT Mode
- Engine-specific Service Protocol extensions
- Crashes
- Supporting legacy platforms
- Metal on iOS FAQ
- Engine Clang Tidy Linter
- Why we have a separate engine repo
- Reduce Flutter engine size with MLGO
- Setting up the Plugins development environment
- Setting up the Packages development environment
- Plugins and Packages repository structure
- Plugin Tests
- Contributing to Plugins and Packages
- Releasing a Plugin or Package
- Unexpected Plugins and Packages failures