Skip to content

Wire up dart:developer inspect(object) to Dart DevTools #2613

Open
@leonsenft

Description

@leonsenft

Feature request

AngularDart DevTools needs the means to jump to the Dart source for a given class in the Debugger view.

Context

In the JavaScript world, this is easily achieved by passing a function (or class) to the Chrome Console inspect(object) function. This in turn opens the location of the function definition in the Chrome Sources panel.

This approach is undesirable for AngularDart for two reasons:

  1. We want to direct users to the Debugger tab in Dart DevTools over Chrome Sources, because ultimately this is where setting breakpoints will be most useful.

  2. inspect() is a JavaScript API which requires interacting with the JavaScript representation of a Dart object. The Dart for Web team has explicitly stated that the JavaScript representation of Dart objects is not stable nor intended for use in this manner. Furthermore, the source maps don't accurately map the class definitions and "constructor" functions back to the correct Dart locations.

Implementation

A possible solution–as suggested by the title–is to have Dart DevTools listen for dart:developer inspect() requests on the VM service protocol. I believe the Debug stream emits events with EventKind Inspect whenever inspect() is called. Given a Dart type, it could retrieve the source location from its Class and use that to open the Debugger at that location.

@jacob314 @grouma

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3issues we think are valid but not importantfix it fridayscreen: debuggerIssues with the Debugger screen

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions