Dhanshree Pajankar
Dhanshree Pajankar

Reputation: 111

Unable to activate Dart Devtools

On opening dart devtools in VS its showing Dart devtools exited with code 255 . I even tried to activating it from terminal in VS by typing flutter pub global activate devtools but its showing could not find a command named “global” for “flutter pub” error error again after activating devtools: error 2

Upvotes: 11

Views: 13930

Answers (10)

Anupama Kumari
Anupama Kumari

Reputation: 11

If the below response is shown, then type dart devtools in terminal

flutter pub global activate devtools
The current Dart SDK version is 3.2.3.

Because pub global activate depends on devtools any which does not support null safety, version solving failed.

The lower bound of "sdk: '>=2.1.0-dev <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety  

Upvotes: 1

Mercutio1243
Mercutio1243

Reputation: 155

Please note that some of the answers here are outdated:

DevTools is shipped as part of the Dart and Flutter SDKs and is no longer shipped on pub. So when you upgrade Flutter, you automatically get the version of DevTools that is shipped with that SDK.

This means, pub commands for DevTools are depreciated, and you should not use legacy commands such as the following:

> flutter pub global activate devtools  
> dart pub global activatedevtools

For me trying them led to various errors. For more information see here: https://github.com/flutter/devtools/issues/7135

Ps: As I do not have enough reputation to comment, I add my learnings as an answer here, hoping that you will avoid this pitfalls.

Upvotes: 0

TijnvdEijnde
TijnvdEijnde

Reputation: 301

I tried the above-mentioned solutions, however, none of them seemed to work for me:

flutter pub global activate devtools
The current Dart SDK version is 3.2.3.

Because pub global activate depends on devtools any which does not support null safety, version solving failed.

The lower bound of "sdk: '>=2.1.0-dev <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety

I ended up executing dart devtools which opened up the Dev Tools.

For more information: https://docs.flutter.dev/tools/devtools/cli

Upvotes: 8

K D
K D

Reputation: 215

To activate devtools, use this command

dart pub global activate devtools

Upvotes: 1

parmeet singh
parmeet singh

Reputation: 79

I am a mac user so you can use this command to enable dart.

export PATH="/Users/<MAC_USER_NAME>/Desktop/developer/flutter/bin/cache/dart-sdk:$PATH"

Upvotes: 0

fpsColton
fpsColton

Reputation: 873

I was experiencing this same issue, and also getting error messages when viewing extension pages

Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker

The solution that fixed both (the error 255 Dart DevTools, and this webview error) was found here (kill all instances of VS Code, then clear VS Code caches).

Upvotes: 0

Кobak
Кobak

Reputation: 1

Ctrl + Shift + P -run command palette. Then run: Run Flutter Upgrade

Upvotes: 0

user11564219
user11564219

Reputation:

Try to disable your antivirus for like 5 minutes and then go to the flutter directory

C:\src\flutter

and run the command

flutter pub global activate devtools

Note: The flutter path should be set in env variables before running this.

Upvotes: 1

Kab Agouda
Kab Agouda

Reputation: 7289

Instead of using flutter pub global activate devtools ,

Use this :
pub global activate devtools

It's the correct way to activate devtools (if you have pub in your path)

Info : You could use flutter pub global activate devtools ,if you have flutter in your path .

Upvotes: 15

R&#233;mi Rousselet
R&#233;mi Rousselet

Reputation: 277567

You have two solutions:

  • Update your flutter version

  • write flutter pub pub global activate my_package (yes, pub is written twice)

Upvotes: 6

Related Questions