dart web : couldn't run webdev

Issue

I installed webdev to run dart web but when I want to run webdev it’s showing an error:

Building package executable... 
Failed to build webdev:webdev:
../../.pub-cache/hosted/pub.dartlang.org/dds-2.1.6/lib/src/cpu_samples_manager.dart:54:21: Error: Type 'CpuSamplesEvent' not found.
  void cacheSamples(CpuSamplesEvent samples) {
                    ^^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dds-2.1.6/lib/src/cpu_samples_manager.dart:54:21: Error: 'CpuSamplesEvent' isn't a type.
  void cacheSamples(CpuSamplesEvent samples) {
                    ^^^^^^^^^^^^^^^

How can I fix it?

Solution

This issue occurs with 2.14.1 of dart, and maybe previous versions. You can update to 2.15.1 of Dart and this will disappear.

There is an official fix in DDS 2.1.6+1 which also fixes the issue, but webdev loads 2.1.6.

You can make it use the new version by calling pub global activate webdev then after you have received the error call pub global activate dds 2.1.6+1 then re-run pub global activate webdev which will succeed.

I put issue on their SDK github, hopefully this will be resolved soon.

Answered By – AndrewL

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *