Created
September 25, 2025 09:54
-
-
Save ffkev/f16abece4f5866d01f42a7c08083c318 to your computer and use it in GitHub Desktop.
Code snippet to export html data from quill editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ElevatedButton( | |
| child: Text('Download as HTML'), | |
| onPressed: () { | |
| final htmlContent = _model.htmlString ?? ''; | |
| final bytes = utf8.encode(htmlContent); | |
| final blob = html.Blob([bytes], 'text/html'); | |
| final url = html.Url.createObjectUrlFromBlob(blob); | |
| final anchor = html.AnchorElement(href: url) | |
| ..setAttribute('download', 'quill_data.html') | |
| ..click(); | |
| html.Url.revokeObjectUrl(url); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment