'dart pub global run webdev serve Building package executable... Failed to build webdev:webdev:

C:\flutter\bin (stable)
λ dart pub global run webdev serve
Building package executable...
Failed to build webdev:webdev:
/C:/Users/valen/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dwds-12.1.1/lib/src/services/chrome_proxy_service.dart:540:24: Error: The method 'ChromeProxyService.getSourceReport' has fewer named arguments than those of overridden method 'VmServiceInterface.getSourceReport'.
  Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
                       ^
/C:/Users/valen/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vm_service-8.3.0/lib/src/vm_service.dart:846:24: Context: This is the overridden method ('getSourceReport').
  Future<SourceReport> getSourceReport(
                       ^
/C:/Users/valen/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dwds-12.1.1/lib/src/services/chrome_proxy_service.dart:540:24: Error: The method 'ChromeProxyService.getSourceReport' doesn't have the named parameter 'libraryFilters' of overridden method 'VmServiceInterface.getSourceReport'.
  Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
                       ^
/C:/Users/valen/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vm_service-8.3.0/lib/src/vm_service.dart:846:24: Context: This is the overridden method ('getSourceReport').
  Future<SourceReport> getSourceReport(
                       ^


Solution 1:[1]

I ran into the same issue and found ChromeProxyService's implementation (dwds-12.1.1) doesn't match vm_service-8.3.0.

You can take a dirty fix as follows.

  1. Open chrome_proxy_service.dart in your pub directory (~/.pub-cache/hosted/pub.dartlang.org/vm_service-8.3.0)
  2. At line 540, add the missing argument: List<String> libraryFilters
  @override
  Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
      {String scriptId,
      int tokenPos,
      int endTokenPos,
      bool forceCompile,
      bool reportLines,
      List<String> libraryFilters}) async {

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tom Yeh