skip to Main Content

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>

1

2

Answers


  1. You can use delta_markdown and markdown package for this:

    String quillDeltaToHtml(Delta delta) {
      final markdown = deltaToMarkdown(delta);
      final html = markdownToHtml(markdown);
    
      return html;
    }
    
    Login or Signup to reply.
  2. First, install the delta_markdown and markdown packages.

    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);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search