matchable_builder 0.7.0+3

Dart native

Matchable builder provides a easier way to find files that you want generate code from.

Matchable Builder #

Matchable builder provides a easier way to find files that you want generate code from.

Usage #

Builder demoBuilder(BuilderOptions ops) => DemoBuilder();

class DemoBuilder extends MatchableBuilder {
  @override
  Matcher get buildStepMatcher => Matcher.and([
        FilenameExtensionMatcher('.dart'),
      ]);

  @override
  Matcher get elementMatcher => Matcher.and([
        ElementTypeMatcher<ClassElement>(),
        ElementAnnotationMatcher<Deprecated>(),
        ElementNamePrefixMatcher('a'),
      ]);

  @override
  Map<String, List<String>> get buildExtensions => {
        '.dart': ['.demo.dart'],
      };

  @override
  FutureOr<void> generate(List<Element> elements, BuildStep buildStep) {
    print('${buildStep.inputId.path} | ${elements}');
    return null;
  }
}
0
likes
70
pub points
29%
popularity

Matchable builder provides a easier way to find files that you want generate code from.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

cpdg128@gmail.com

License

MIT (LICENSE)

Dependencies

analyzer, build, glob, meta, source_gen

More

Packages that depend on matchable_builder