'Flutter: How to copy HTML into the clipboard so mail apps recognize it as HTML?

Is it possible to copy HTML and paste it into Gmail or Apple Mail?

Sample HTML:

<img src="w3schools.jpg" alt="W3Schools.com"
width="104" height="142">

I've tried a few different approaches, such as using

Clipboard.setData(ClipboardData(text: myHtmlCode));

and

FlutterClipboard.copy(myHtmlCode).then((value) => print('copied'));

The result is always the same, it pastes literal html code into the mail app instead of jpg or styles. Outlook, on the other hand, does work. I've seen several other apps that do this successfully, but I can't seem to figure it out.

Chatting with colleagues, it seems to be related to copy plain/text and copy plain/html, but I'm still not sure.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source