Dart DevTools exited with code 255解决

尝试从 Visual Studio Code 打开 DevTools 时,我看到此错误消息:

Dart DevTools exited with code 255 in brand new flutter installation

解决方法

运行命令

pub global activate devtools

//完成后会提示如下
ackage devtools is currently active at version 2.9.2.
Resolving dependencies... (2.2s)
The package devtools is already activated at newest available version.
To recompile executables, first run `global decativate devtools`.
Installed executable devtools.
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

export PATH="$PATH":"$HOME/.pub-cache/bin"

Activated devtools 2.9.2.

//根据提示继续输入
export PATH="$PATH":"$HOME/.pub-cache/bin"

搞定!