devtools icon indicating copy to clipboard operation
devtools copied to clipboard

`DartToolingDaemon` service methods are hard to discover

Open Rexios80 opened this issue 3 months ago • 2 comments

Since the service methods on DartToolingDaemon are provided in extensions, it is hard to discover them unless you depend on the dtd package. I tried to resolve this in #9449, but I'm not sure that solution makes sense. Maybe we just need better documentation?

Rexios80 avatar Sep 30 '25 18:09 Rexios80

Hi @Rexios80 - I'm trying to understand what your use case here. Are you trying to build a DevTools extension, or something else? DevTools Extensions should have access to any service method registered on DTD. Thanks!

elliette avatar Oct 06 '25 19:10 elliette

Yes I wrote a devtools extension.

The documentation for devtools_extensions promises that you can build tools that interact with the file system:

https://github.com/flutter/devtools/blob/0327830448901920f739259364c3f2f624df5a03/packages/devtools_extensions/README.md?plain=1#L31

However the methods for filesystem access are only available in an extension on the DartToolingDaemon:

https://github.com/dart-lang/sdk/blob/3fa73a302bfe0770912e34a0e16f8d7e833d5d60/pkg/dtd/lib/src/services/file_system_service.dart#L15

Methods declared in extensions are only available if you directly depend on the package that defines them. Since the dtdManager comes from the devtools_app package:

https://github.com/flutter/devtools/blob/0327830448901920f739259364c3f2f624df5a03/packages/devtools_app/lib/src/shared/globals.dart#L48

You do not have access to the DartToolingDaemon extension methods without manually depending on the dtd package. This is not a good dev experience. I about gave up on writing the feature that needs file system access.

Rexios80 avatar Oct 06 '25 19:10 Rexios80