I used flutter_quill: ^6.1.7 to create such a design But I can’t send the html text to the api Such as <h1 > Title </h1>
<h1 > Title </h1>
2
You can use delta_markdown and markdown package for this:
String quillDeltaToHtml(Delta delta) { final markdown = deltaToMarkdown(delta); final html = markdownToHtml(markdown); return html; }
First, install the delta_markdown and markdown packages.
delta_markdown
markdown
Then, try the following code:
import 'package:delta_markdown/delta_markdown.dart'; import 'package:markdown/markdown.dart' hide Text;
final QuillController quillController = QuillController.basic();
QuillToolbar.basic( controller: quillController, … ),
final Delta delta = quillController.document.toDelta(); final String convertedValue = jsonEncode(delta.toJson()); final String markdown = deltaToMarkdown(convertedValue); final String html = markdownToHtml(markdown);
Click here to cancel reply.
2
Answers
You can use delta_markdown and markdown package for this:
First, install the
delta_markdown
andmarkdown
packages.Then, try the following code: