codeBuilder method

Widget codeBuilder(
  1. BuildContext context,
  2. String name,
  3. String code,
  4. bool closed,
)

Renders code blocks with syntax highlighting using CodeSnippet.

This builder function takes the code language, content, and closure state, returning a CodeSnippet widget configured for the specified mode. It supports various languages for accurate highlighting, integrating with ArcaneTheme for consistent code styling. Used in block-level code rendering within GptMarkdown, ideal for technical docs in Section or tutorials in SliverScreen. Simple and performant, with no additional computations.

Implementation

Widget codeBuilder(
        BuildContext context, String name, String code, bool closed) =>
    CodeSnippet(code: code, mode: name);