build method
Generates the outputs for a given BuildStep
.
Implementation
@override
Future<void> build(BuildStep buildStep) async {
var targetId = buildStep.inputId.toString();
if (targetId.contains('.vm_test.') ||
targetId.contains('.node_test.') ||
targetId.contains('.browser_test.')) {
return;
}
LibraryElement inputLibrary = await buildStep.inputLibrary;
Resolver resolver = buildStep.resolver;
AssetId inputId = buildStep.inputId;
AssetId outputId = inputId.changeExtension('.reflectable.dart');
List<LibraryElement> visibleLibraries = await resolver.libraries.toList();
String generatedSource = await BuilderImplementation().buildMirrorLibrary(
resolver, inputId, outputId, inputLibrary, visibleLibraries, true, []);
await buildStep.writeAsString(outputId, generatedSource);
}