macro_util 0.1.0-11.dev copy "macro_util: ^0.1.0-11.dev" to clipboard
macro_util: ^0.1.0-11.dev copied to clipboard

Helpers and utilities for developing macros: field introspection, generated code formatting, etc.

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.introspectFields(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',
  ]),
);

Report errors with 5 less lines of code #

builder.reportError('Error message', target: target);

...instead of

builder.report(
  Diagnostic(
    DiagnosticMessage('Error message', target: target),
    Severity.error,
  ),
);
5
likes
0
pub points
56%
popularity

Publisher

verified publisherainkin.com

Helpers and utilities for developing macros: field introspection, generated code formatting, etc.

Repository (GitHub)
View/report issues

Topics

#macros

License

unknown (license)

Dependencies

macros

More

Packages that depend on macro_util