Failed to start DevTools: Dart DevTools exited with code 255

I am getting this error code in my vscode. How to fix it? I am using flutter v2.5.3.

You can try fixing it by running this in the terminal:

Just copy and paste the below code into the terminal and run it.

dart pub global activate devtools -v 2.8.0

which downgrades the version to 2.8.0 (that works fine). Found answer on GitHub