Skip to content

Custom commands to obtain the Dart and Flutter SDK roots dynamically  #5334

@davidmartos96

Description

@davidmartos96

Is your feature request related to a problem? Please describe.

This is a proposal to fix issues such as #5117 , where the path to the SDK is not statically known when using tools such as ASDF, mise or direnv.
It would be great if there was a setting which lets the user provide a command to run that should print to stdout the SDK path. This would allow a project to provide a command such as asdf where flutter with the working directory being the firstFlutterProject variable in the extension source code or the workspaceFile directory in case there is one.
This would let these kind of tools automatically switch vesions according to each project requirements or even let the user define a custom shell/python script based on their own rules.

Describe alternatives you've considered
I've tried using the FLUTTER_ROOT variable in the shell configuration as "$(asdf where flutter)", but that will not be dynamic, which defeats the whole purpose of these versioning tools.

The following simple proof of concept works as expected.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions