generateMergedContent method
Returns the merged content that will be written to the output file by
MergingBuilder
.
- Override this method in classes extending
MergingGenerator
. - Note:
stream
contains objects generated for all annotated elements found in all files that match the inputGlob
of theMergingBuilder
.
Implementation
@override
Future<String> generateMergedContent(Stream<Definition> stream) async {
var imports = <String>{};
var definitions = await stream.map((definition) {
for (var element in definition.imports) {
imports.add("import '$element';");
}
return definition.registration;
}).join("\n");
return """
import 'package:fabric_manager/fabric_manager.dart';
${imports.join("\n")}
Fabric createFabric() {
var fabric = Fabric();
$definitions
return fabric;
}
""";
}