toDartPage function

String toDartPage(
  1. SrcPage srcPage
)

convert src page to dart code

Implementation

String toDartPage(SrcPage srcPage) {
  final rawMarkdown = utf8.decode(srcPage.content);
  final escapedMarkdown = _escapeForDart(rawMarkdown);

  final codeName = toCodeName(srcPage.name);
  final content = """
// ignore_for_file: constant_identifier_names, file_names
import 'package:comet/comet.dart';

const $codeName = CometGenPage(
  srcName: '${srcPage.name}',
  content: _content,
);

const _content = '''
$escapedMarkdown
''';
""";
  return content;
}