Last updated:
0 purchases
macro util
Helpers and utilities for developing macros.
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 builder.introspectFields(clazz);
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
Report errors with 5 less lines of code #
builder.reportError('Error message', target: target);
copied to clipboard
...instead of
builder.report(
Diagnostic(
DiagnosticMessage('Error message', target: target),
Severity.error,
),
);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.