Helpers and utilities for developing macros.
builder.log('Got here.');
Output:
// Got here.
final map = await builder.introspectFields(clazz);
final type = map['fieldName']!.typeDeclaration;
builder.declareInLibrary(
DeclarationCode.fromParts([
'augment class Foo {\n',
..._getMyMethodParts().indent(), // Adds 2 spaces before each line of the code.
'}\n',
]),
);
builder.reportError('Error message', target: target);
...instead of
builder.report(
Diagnostic(
DiagnosticMessage('Error message', target: target),
Severity.error,
),
);