sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Is that possible to set breakpoints in the macro code itself?

Open alphamikle opened this issue 8 months ago • 2 comments

Hi!

I'm wondering - what are the possible ways to debug we have while developing new macros? The main question - is that possible somehow to put breakpoints into the code of macros itself to introspect something inside?

Like, for example:

import 'dart:async';
import 'dart:developer';

import 'package:macros/macros.dart';

macro class EmptyMacro implements ClassDeclarationsMacro {
  @override
  FutureOr<void> buildDeclarationsForClass(ClassDeclaration clazz, MemberDeclarationBuilder builder) async {
    debugger(message: 'I want to see, what the inside of "clazz"'); // <- I wanna put a breakpoint here to see, what the inside of "clazz"
  }
}

The way with Builder.report is something, at least, but definitely not the best. Maybe there is something better already?

alphamikle avatar Jun 28 '24 07:06 alphamikle