InlineCodeBuilder typedef

InlineCodeBuilder = InlineSpan Function(BuildContext context, String code, TextStyle style, InlineCodeStyle codeStyle)

Builds the span for one run of inline `code`.

code is the text between the backticks, style is the resolved code TextStyle (monospace, sized and coloured per InlineCodeStyle), and codeStyle is the resolved InlineCodeStyle itself, so a builder can reuse the chip colours it would have been drawn with.

Return a CodeTextSpan to keep the painted chip, any other TextSpan to drop it, or baselineWidgetSpan when a widget is genuinely required:

inlineCodeBuilder: (context, code, style, codeStyle) => CodeTextSpan(
  text: code,
  codeStyle: codeStyle.copyWith(
    backgroundColor: code.startsWith('TODO') ? Colors.amber : null,
  ),
  style: style,
),

Returning an InlineSpan rather than a Widget is what keeps inline code on the text baseline, wrapping across lines, and selectable.

Implementation

typedef InlineCodeBuilder =
    InlineSpan Function(
      BuildContext context,
      String code,
      TextStyle style,
      InlineCodeStyle codeStyle,
    );