diff --git a/packages/flutter_markdown/test/custom_syntax_test.dart b/packages/flutter_markdown/test/custom_syntax_test.dart index 7fee7ce63b6c..6254a1be990b 100644 --- a/packages/flutter_markdown/test/custom_syntax_test.dart +++ b/packages/flutter_markdown/test/custom_syntax_test.dart @@ -160,9 +160,10 @@ class WikilinkSyntax extends md.InlineSyntax { @override bool onMatch(md.InlineParser parser, Match match) { - final md.Element el = md.Element.withTag('wikilink'); - el.attributes['href'] = match[1]!.replaceAll(' ', '_'); - el.children!.add(md.Element.text('span', match[1]!)); + final String link = match[1]!; + final md.Element el = + md.Element('wikilink', [md.Element.text('span', link)]) + ..attributes['href'] = link.replaceAll(' ', '_'); parser.addNode(el); return true;