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

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

example/README.md

Log information in into the augmenting library as code comments #

builder.log('Got here.');
copied to clipboard

Output:

// Got here.
copied to clipboard

Introspect all fields of a type #

final map = await FieldIntrospectionData.introspectType(clazz, builder);
final type = map['fieldName']!.typeDeclaration;
copied to clipboard

Indent the generated code #

builder.declareInLibrary(
  DeclarationCode.fromParts([
    'augment class Foo {\n',
    ..._getMyMethodParts().indent(), // Adds 2 spaces before each line of the code.
    '}\n',
  ]),
);
copied to clipboard
6
likes
150
points
104
downloads

Publisher

verified publisherainkin.com

Weekly Downloads

2024.09.23 - 2025.04.07

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

Repository (GitHub)

Topics

#macros

Documentation

API reference

License

MIT-0 (license)

Dependencies

macros

More

Packages that depend on macro_util