flutter / devtools

Performance tools for Flutter

Home Page:https://flutter.dev/docs/development/tools/devtools/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flutter pub global activate devtools - The lower bound of "sdk: '>=2.1.0-dev <3.0.0'" must be 2.12.0 or higher to enable null safety.

Mercutio1243 opened this issue · comments

Dear team, I want to update devtools in visual studio code because I have issues with the performance view (endless loading of the view). However, when running the recommended update command in terminal, I keep getting the following error:

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

Because pub global activate depends on devtools any which doesn't 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

Flutter seems fine:

>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.19045.3930], locale de-DE)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.1)
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.85.2)
[√] Connected device (4 available)
[√] Network resources

• No issues found!

Dart is of version 3.2.3.

My pubspec.yaml specifies:

environment:
  sdk: '>=3.1.5 <4.0.0'

Others have experienced the same issues, see here: flutter/flutter#123681. I could not find any solution online.

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. We release monthly, so each Flutter beta and stable have a new version of DevTools. You can see the release notes here: https://docs.flutter.dev/tools/devtools/release-notes.

If you run dart devtools you can launch a standalone version of DevTools in the browser. Otherwise, VS code will spin up DevTools directly from the Flutter SDK, and you can open DevTools from the Flutter VS Code sidebar or from the command palette.

I'm going to close this issue since it is related to the legacy DevTools that is shipped on Pub. If you are experiencing issues with the Performance view in VS code, please file a separate issue with repro steps. A screenshot or screen recording would also be helpful. Thanks!

Thanks for clarifying! Btw, I managed to get DevTools running by other methods.

Still, the error specifically and the entire legacy situation with pub might be confusing for some, especially, if you follow older online guides and discussions. Maybe, there is a way to include a note when trying to launch it via pub...

The package is discontinued on pub: https://pub.dev/packages/devtools, and IIRC we added a warning to the last published version of DevTools on pub which warned users that DevTools would no longer be published on pub and that they should switch to using DevTools directly from the Flutter SDK.

Up to date docs on how to launch DevTools are on flutter.dev: https://docs.flutter.dev/tools/devtools/vscode.

Would you mind sharing a link to the guides you were following that were referencing DevTools from pub?

Many thanks for the explanation! Is there no possibility to include a legacy warning when running a command like >flutter pub global activate devtools to prevent this? I mean, now people hopefully will find this discussion here, but beforehand for an amateur user it was difficult to understand this.

In any case, I will leave some comments later today on the stockoverflow pages that I visited and that pointed me towards using "flutter pub global activate devtools" to get it activated!