build method Null safety

  1. @override
Future<FutureOr<void>> build(
  1. BuildStep buildStep
)
override

For each MarkdownTemplate the MarkdownTemplateBuilder will:

Implementation

@override
Future<FutureOr<void>> build(BuildStep buildStep) async {
  var factories = MarkdownTemplateFactories();
  try {
    String markdownTemplatePath = buildStep.inputId.path;
    MarkdownTemplateFactory factory =
        factories.firstWhere((f) => f.canCreateFor(markdownTemplatePath));
    DocumentationModel model =
        await buildStep.fetchResource<DocumentationModel>(resource);
    var markdownPage = factory.createMarkdownPage(model, buildStep.inputId.path);

    model.add(markdownPage);
  } on Error {
    print('Unknown mark down template file: ${buildStep.inputId.path}');
  }
}