dart-lang / webdev

A CLI for Dart web development.
https://pub.dev/packages/webdev
213 stars 71 forks source link

getObject: (-32603) Unexpected DWDS error for getObject: Unsupported operation: Only libraries, instances, classes, and scripts are supported for getObject #2446

Open Jordan-Nelson opened 3 weeks ago

Jordan-Nelson commented 3 weeks ago

I am unable to view a getter in Dart's dev tools with the following app on web only. I am unsure if this is supposed to work, but I don't see why it shouldn't.

Screenshot 2024-06-11 at 5 40 38 PM

Steps to repro:

  1. create a flutter app with the code below
  2. run app on web
  3. set break point on the print statement
  4. view the local vars in dev tools
import 'package:flutter/material.dart';

class CustomHttpRequest {
  const CustomHttpRequest(this.bytes);
  final List<int> bytes;
  Stream<List<int>> get body => Stream.value(bytes);
}

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(),
        body: Center(
          child: Column(
            children: [
              FilledButton(
                onPressed: () {
                  const r = CustomHttpRequest([1, 2, 3]);
                  print('r body: ${r.body}');
                },
                child: const Text('request'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
CoderDake commented 3 weeks ago

Error thrown here: https://github.com/dart-lang/webdev/blob/9ada46fc00f4052a02b1816c534f2df67d2efc1b/dwds/lib/src/debugging/inspector.dart#L416-L417

We'll have to take a closer look into how we might be able to grab that information and pass it along.

Lorenzobettega commented 2 weeks ago

I encountered the same issue in my code when I attempted to cast() an Object List. The debugger showed a generic error in the devTools for web. my flutter doctor: [√] Chrome - develop for the web I'm thinking that this is related to the old issue: #2297 image