build method

  1. @override
Widget build(
  1. BuildContext context,
  2. String text,
  3. GptMarkdownConfig config
)
override

Implementation

@override
Widget build(
  BuildContext context,
  String text,
  final GptMarkdownConfig config,
) {
  String codes = this.exp.firstMatch(text)?[2] ?? "";
  String name = this.exp.firstMatch(text)?[1] ?? "";
  codes = codes.replaceAll(r"```", "").trim();
  bool closed = text.endsWith("```");

  return config.codeBuilder?.call(context, name, codes, closed) ??
      CodeField(name: name, codes: codes);
}