codifyString method

InlineSpan codifyString(
  1. String content,
  2. DartCodeViewerThemeData dartCodeViewerThemeData
)

Implementation

InlineSpan codifyString(
  String content,
  DartCodeViewerThemeData dartCodeViewerThemeData,
) {
  final textSpans = <TextSpan>[];
  final codeSpans = DartSyntaxPreHighlighter().format(content);
  // Converting CodeSpan to TextSpan by first converting to a string and then TextSpan.
  for (final span in codeSpans) {
    textSpans.add(stringToTextSpan(span.toString(), dartCodeViewerThemeData));
  }
  return TextSpan(children: textSpans);
}