flutter / devtools

Performance tools for Flutter
https://flutter.dev/docs/development/tools/devtools/
BSD 3-Clause "New" or "Revised" License
1.59k stars 327 forks source link

getObject on a VMService Library ref is unreliable on Flutter Web applications. #3110

Open jacob314 opened 3 years ago

jacob314 commented 3 years ago

Example output running on Flutter Gallery:

getObject: Unexpected error from chrome devtools:
text: Uncaught
exception:
  description: null
  type: string
  value: cannot find library for package:gallery/demos/material/material_demos.dart
attempted JS eval: `    (function() {
         var sdkUtils = require('dart_sdk').dart;
   var library = sdkUtils.getLibrary('package:gallery/demos/material/material_demos.dart');
   if (!library) throw 'cannot find library for package:gallery/demos/material/material_demos.dart';

      var result = {};
      var classes = Object.values(Object.getOwnPropertyDescriptors(library))
        .filter((p) => 'value' in p)
        .map((p) => p.value)
        .filter((l) => l && sdkUtils.isType(l));
      var classList = classes.map(function(clazz) {
        var descriptor = {
          'name': clazz.name,
          'dartName': sdkUtils.typeName(clazz)
        };
        return descriptor;
      });
      result['classes'] = classList;
      return result;
    })()
    `
annagrin commented 3 years ago

@jacob314 how can I repro the bug?

jacob314 commented 3 years ago

Repro is to call getObject on gallery/demos/material/material_demos.dart Unblocked as the libraries it fails on do not appear to be really live in the project.