Skip to content

alexeyinkin/dart-macro-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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,
  ),
);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages