macro_util 0.1.0-3.dev macro_util: ^0.1.0-3.dev copied to clipboard
Helpers and utilities for developing macros.
Helpers and utilities for developing macros.
Log information in into the augmenting library as code comments #
builder.log('Got here.');
Output:
// Got here.
Introspect all fields of a type #
final map = await builder.introspectType(clazz);
final type = map['fieldName']!.typeDeclaration;
Indent the generated code #
builder.declareInLibrary(
DeclarationCode.fromParts([
'augment class Foo {\n',
..._getMyMethodParts().indent(), // Adds 2 spaces before each line of the code.
'}\n',
]),
);