buildCodePreviewBuilder function

Future<void> buildCodePreviewBuilder(
  1. List<SlideData> slides
)

Implementation

Future<void> buildCodePreviewBuilder(List<SlideData> slides) async {
  List<Class> widgets = [];

  for (var slide in slides) {
    if (slide.options.codePreview) {
      for (var snippet in slide.snippets) {
        final widget = statelessWidgetBuilder(
          slide,
          snippet.widgetName,
          snippet.source,
        );
        widgets.add(widget);
      }
    }
  }

  final library = libraryBuilder(
    widgets,
    directives: [
      Directive.import('package:flutter/material.dart'),
      Directive.import('package:mix/mix.dart'),
    ],
  );

  final codePreviewFile = kShowtimeDirectory.codePreviewFile;

  await runCodeEmitter(library, codePreviewFile);
}